Commit 28800cb2 authored by Tal Lossos's avatar Tal Lossos Committed by Zheng Zengkai
Browse files

bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF



stable inclusion
from stable-5.10.27
commit f7c3d7615e6c62d13e2b56b9eaf029f682e44cf8
bugzilla: 51493

--------------------------------

[ Upstream commit 769c18b2 ]

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: 8ea63684 ("bpf: Implement bpf_local_storage for inodes")
Signed-off-by: default avatarTal Lossos <tallossos@gmail.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarYonghong Song <yhs@fb.com>
Acked-by: default avatarKP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210307120948.61414-1-tallossos@gmail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatar  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent d60d5075
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment