diff options
| author | Ciara Loftus <ciara.loftus@intel.com> | 2021-03-31 06:12:16 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-14 08:42:00 +0200 |
| commit | 5aa7df172207e2b927803ec27a0e1aee5ac45eda (patch) | |
| tree | 75788302b409d0122a90d60c4931c34ca8b25d4a /tools/lib | |
| parent | b52e88638f7105ca6921eff9970a5ad261b1a1bf (diff) | |
libbpf: Ensure umem pointer is non-NULL before dereferencing
commit df662016310aa4475d7986fd726af45c8fe4f362 upstream.
Calls to xsk_socket__create dereference the umem to access the
fill_save and comp_save pointers. Make sure the umem is non-NULL
before doing this.
Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devices")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20210331061218.1647-2-ciara.loftus@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/bpf/xsk.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index f6e8831673f9..71a9be49b5df 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -870,6 +870,9 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, struct xsk_ring_cons *rx, struct xsk_ring_prod *tx, const struct xsk_socket_config *usr_config) { + if (!umem) + return -EFAULT; + return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem, rx, tx, umem->fill_save, umem->comp_save, usr_config); |
