projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d55b70
)
bpf: Fix map permissions check
author
Anton Protopopov
<a.s.protopopov@gmail.com>
Wed, 27 May 2020 18:56:59 +0000
(18:56 +0000)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:31:11 +0000
(09:31 +0200)
[ Upstream commit
1ea0f9120c8ce105ca181b070561df5cbd6bc049
]
The map_lookup_and_delete_elem() function should check for both FMODE_CAN_WRITE
and FMODE_CAN_READ permissions because it returns a map element to user space.
Fixes:
bd513cd08f10
("bpf: add MAP_LOOKUP_AND_DELETE_ELEM syscall")
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link:
https://lore.kernel.org/bpf/20200527185700.14658-5-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/syscall.c
patch
|
blob
|
history
diff --git
a/kernel/bpf/syscall.c
b/kernel/bpf/syscall.c
index
946cfdd
..
e7af1ac
100644
(file)
--- a/
kernel/bpf/syscall.c
+++ b/
kernel/bpf/syscall.c
@@
-1118,7
+1118,8
@@
static int map_lookup_and_delete_elem(union bpf_attr *attr)
map = __bpf_map_get(f);
if (IS_ERR(map))
return PTR_ERR(map);
- if (!(map_get_sys_perms(map, f) & FMODE_CAN_WRITE)) {
+ if (!(map_get_sys_perms(map, f) & FMODE_CAN_READ) ||
+ !(map_get_sys_perms(map, f) & FMODE_CAN_WRITE)) {
err = -EPERM;
goto err_put;
}