]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
bpf, xdp, samples: Fix null pointer dereference in *_user code
authorGaurav Singh <gaurav1086@gmail.com>
Fri, 12 Jun 2020 18:53:27 +0000 (14:53 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
commit8f00444ae1f7d176f4b71e41d51011e2983efada
tree454dbf2322c1a8125e98c8feffbd7fabe8ca59d9
parent87650387351460e5de74ee0aca643e0f188d617a
bpf, xdp, samples: Fix null pointer dereference in *_user code

BugLink: https://bugs.launchpad.net/bugs/1885942
[ Upstream commit 6903cdae9f9f08d61e49c16cbef11c293e33a615 ]

Memset on the pointer right after malloc can cause a NULL pointer
deference if it failed to allocate memory. A simple fix is to
replace malloc()/memset() pair with a simple call to calloc().

Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to xdp_rxq_info")
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
samples/bpf/xdp_monitor_user.c
samples/bpf/xdp_redirect_cpu_user.c
samples/bpf/xdp_rxq_info_user.c