]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
libbpf: Use proper errno value in nlattr
authorAnton Protopopov <a.s.protopopov@gmail.com>
Sat, 10 May 2025 18:20:11 +0000 (18:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:13 +0000 (11:05 +0100)
commit12cda7fcc4cfd6f9ada27a01105f9b9638c4406d
treef71bbf07d2bf5ad89d4930e5c80a6f68699e25c3
parent2fef0e86682fa39ec48cbb120fdc13ff96857792
libbpf: Use proper errno value in nlattr

[ Upstream commit fd5fd538a1f4b34cee6823ba0ddda2f7a55aca96 ]

Return value of the validate_nla() function can be propagated all the
way up to users of libbpf API. In case of error this libbpf version
of validate_nla returns -1 which will be seen as -EPERM from user's
point of view. Instead, return a more reasonable -EINVAL.

Fixes: bbf48c18ee0c ("libbpf: add error reporting in XDP")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250510182011.2246631-1-a.s.protopopov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/nlattr.c