]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
libbpf: Fix alen calculation in libbpf_nla_dump_errormsg()
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 10 Feb 2023 00:12:01 +0000 (01:12 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:32 +0000 (16:46 +0100)
commit0771e6bed6b03e0d750140eb185b914a8513f13c
treead4910a97195933a652b5c6186d82faed7b3a9ef
parent45858e88dde5480269f5cb6b0fba47e8de8dc3af
libbpf: Fix alen calculation in libbpf_nla_dump_errormsg()

BugLink: https://bugs.launchpad.net/bugs/2011425
[ Upstream commit 17bcd27a08a21397698edf143084d7c87ce17946 ]

The code assumes that everything that comes after nlmsgerr are nlattrs.
When calculating their size, it does not account for the initial
nlmsghdr. This may lead to accessing uninitialized memory.

Fixes: bbf48c18ee0c ("libbpf: add error reporting in XDP")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230210001210.395194-8-iii@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
tools/lib/bpf/nlattr.c