Message ID | 1604396490-12129-2-git-send-email-magnus.karlsson@gmail.com |
---|---|
State | Not Applicable |
Delegated to: | BPF Maintainers |
Headers | show |
Series | libbpf: fix two bugs in xsk_socket__delete | expand |
Context | Check | Description |
---|---|---|
jkicinski/cover_letter | success | Link |
jkicinski/fixes_present | success | Link |
jkicinski/patch_count | success | Link |
jkicinski/tree_selection | success | Clearly marked for bpf |
jkicinski/subject_prefix | success | Link |
jkicinski/source_inline | success | Was 0 now: 0 |
jkicinski/verify_signedoff | success | Link |
jkicinski/module_param | success | Was 0 now: 0 |
jkicinski/build_32bit | fail | Errors and warnings before: 4 this patch: 4 |
jkicinski/kdoc | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/verify_fixes | success | Link |
jkicinski/checkpatch | fail | Link |
jkicinski/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/header_inline | success | Link |
jkicinski/stable | success | Stable not CCed |
On Tue, Nov 3, 2020 at 1:41 AM Magnus Karlsson <magnus.karlsson@gmail.com> wrote: > > From: Magnus Karlsson <magnus.karlsson@intel.com> > > Fix a possible null pointer dereference in xsk_socket__delete that > will occur if a null pointer is fed into the function. > > Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devices") > Reported-by: Andrii Nakryiko <andrii.nakryiko@gmail.com> > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> > --- Acked-by: Andrii Nakryiko <andrii@kernel.org> > tools/lib/bpf/xsk.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c > index e3c98c0..504b7a8 100644 > --- a/tools/lib/bpf/xsk.c > +++ b/tools/lib/bpf/xsk.c > @@ -891,13 +891,14 @@ int xsk_umem__delete(struct xsk_umem *umem) > void xsk_socket__delete(struct xsk_socket *xsk) > { > size_t desc_sz = sizeof(struct xdp_desc); > - struct xsk_ctx *ctx = xsk->ctx; > struct xdp_mmap_offsets off; > + struct xsk_ctx *ctx; > int err; > > if (!xsk) > return; > > + ctx = xsk->ctx; > if (ctx->prog_fd != -1) { > xsk_delete_bpf_maps(xsk); > close(ctx->prog_fd); > -- > 2.7.4 >
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index e3c98c0..504b7a8 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -891,13 +891,14 @@ int xsk_umem__delete(struct xsk_umem *umem) void xsk_socket__delete(struct xsk_socket *xsk) { size_t desc_sz = sizeof(struct xdp_desc); - struct xsk_ctx *ctx = xsk->ctx; struct xdp_mmap_offsets off; + struct xsk_ctx *ctx; int err; if (!xsk) return; + ctx = xsk->ctx; if (ctx->prog_fd != -1) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd);