]> git.baikalelectronics.ru Git - kernel.git/commit
xsk: Fix possible segfault in xsk umem diagnostics
authorMagnus Karlsson <magnus.karlsson@intel.com>
Wed, 2 Sep 2020 08:52:23 +0000 (10:52 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 2 Sep 2020 14:49:40 +0000 (16:49 +0200)
commitdf50e68ff3987b1086956b7004d6170eb032a11f
tree42d52f57c17258c1c57da9ff5ff8081c2975fb99
parentef51acf33ef373acb64de2dd00eca554e40c5a4a
xsk: Fix possible segfault in xsk umem diagnostics

Fix possible segfault in the xsk diagnostics code when dumping
information about the umem. This can happen when a umem has been
created, but the socket has not been bound yet. In this case, the xsk
buffer pool does not exist yet and we cannot dump the information
that was moved from the umem to the buffer pool. Fix this by testing
for the existence of the buffer pool and if not there, do not dump any
of that information.

Fixes: 02a64ddc554a ("xsk: Move queue_id, dev and need_wakeup to buffer pool")
Fixes: 9bcc1b173abd ("xsk: Move fill and completion rings to buffer pool")
Reported-by: syzbot+3f04d36b7336f7868066@syzkaller.appspotmail.com
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/1599036743-26454-1-git-send-email-magnus.karlsson@intel.com
net/xdp/xsk_diag.c