Commit 9d6b4bfb authored by David S. Miller's avatar David S. Miller

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Daniel Borkmann says:

====================
pull-request: bpf 2018-05-14

The following pull-request contains BPF updates for your *net* tree.

The main changes are:

1) Fix nfp to allow zero-length BPF capabilities, meaning the nfp
   capability parsing loop will otherwise exit early if the last
   capability is zero length and therefore driver will fail to probe
   with an error such as:

     nfp: BPF capabilities left after parsing, parsed:92 total length:100
     nfp: invalid BPF capabilities at offset:92

   Fix from Jakub.

2) libbpf's bpf_object__open() may return IS_ERR_OR_NULL() and not
   just an error. Fix libbpf's bpf_prog_load_xattr() to handle that
   case as well, also from Jakub.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4f6b15c3 3597683c
...@@ -335,7 +335,7 @@ static int nfp_bpf_parse_capabilities(struct nfp_app *app) ...@@ -335,7 +335,7 @@ static int nfp_bpf_parse_capabilities(struct nfp_app *app)
return PTR_ERR(mem) == -ENOENT ? 0 : PTR_ERR(mem); return PTR_ERR(mem) == -ENOENT ? 0 : PTR_ERR(mem);
start = mem; start = mem;
while (mem - start + 8 < nfp_cpp_area_size(area)) { while (mem - start + 8 <= nfp_cpp_area_size(area)) {
u8 __iomem *value; u8 __iomem *value;
u32 type, length; u32 type, length;
......
...@@ -2035,7 +2035,7 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr, ...@@ -2035,7 +2035,7 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr,
return -EINVAL; return -EINVAL;
obj = bpf_object__open(attr->file); obj = bpf_object__open(attr->file);
if (IS_ERR(obj)) if (IS_ERR_OR_NULL(obj))
return -ENOENT; return -ENOENT;
bpf_object__for_each_program(prog, obj) { bpf_object__for_each_program(prog, obj) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment