]> git.baikalelectronics.ru Git - kernel.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:41 +0000 (16:43 +0100)
commitee136521202d67a696fd4106de24ce5c5d6c676d
tree3ea8325ea3b2eea6d0d1cf6d31fa746cdf732096
parent972a3c1ed454855074b883e599532bf8aba0b8d0
libbpf: Fix alen calculation in libbpf_nla_dump_errormsg()

[ 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: 8a1a250c9448 ("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>
tools/lib/bpf/nlattr.c