bpf: Fix error return code in map_lookup_and_delete_elem()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 30 Apr 2020 08:18:51 +0000 (08:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 May 2020 06:20:19 +0000 (08:20 +0200)
commit5d47b3d6b4d2d554d075823d572706cfd958484a
tree94d028878ed1c77e21c8ab01fac9380265a1cb1c
parent5b96668b63c0f7d440b25eac96e2d528a7d1c73c
bpf: Fix error return code in map_lookup_and_delete_elem()

[ Upstream commit 7f645462ca01d01abb94d75e6768c8b3ed3a188b ]

Fix to return negative error code -EFAULT from the copy_to_user() error
handling case instead of 0, as done elsewhere in this function.

Fixes: bd513cd08f10 ("bpf: add MAP_LOOKUP_AND_DELETE_ELEM syscall")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200430081851.166996-1-weiyongjun1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/syscall.c