]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF
authorTal Lossos <tallossos@gmail.com>
Sun, 7 Mar 2021 12:09:48 +0000 (14:09 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Mar 2021 15:08:06 +0000 (16:08 +0100)
commit4f0d6540265dc9f5a55afcf485a71df9bd324246
treecb35ce94db582bd6fd717ac4340d08e4ead21168
parentea959897a004ff716a9b1cd4116830575e82b241
bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF

bpf_fd_inode_storage_lookup_elem() returned NULL when getting a bad FD,
which caused -ENOENT in bpf_map_copy_value. -EBADF error is better than
-ENOENT for a bad FD behaviour.

The patch was partially contributed by CyberArk Software, Inc.

Fixes: 7ac4e9cab472 ("bpf: Implement bpf_local_storage for inodes")
Signed-off-by: Tal Lossos <tallossos@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210307120948.61414-1-tallossos@gmail.com
kernel/bpf/bpf_inode_storage.c