[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210412084017.837456288@linuxfoundation.org>
Date: Mon, 12 Apr 2021 10:39:20 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Ciara Loftus <ciara.loftus@...el.com>,
Alexei Starovoitov <ast@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>
Subject: [PATCH 5.11 055/210] libbpf: Ensure umem pointer is non-NULL before dereferencing
From: Ciara Loftus <ciara.loftus@...el.com>
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@...el.com>
Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>
Link: https://lore.kernel.org/bpf/20210331061218.1647-2-ciara.loftus@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
tools/lib/bpf/xsk.c | 3 +++
1 file changed, 3 insertions(+)
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -944,6 +944,9 @@ int xsk_socket__create(struct xsk_socket
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);
Powered by blists - more mailing lists