diff options
author | Hou Tao <houtao1@huawei.com> | 2022-08-10 11:05:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-25 12:37:55 +0300 |
commit | b9d9cf88c828d5c6071c8e8c025210d5269cb499 (patch) | |
tree | 9a7e26b5222fdd9eb06b4c1457c7a1672ef6f4e0 /net | |
parent | f7d844df5e20dd1ca32a697f188e98ad90f29d8e (diff) | |
download | linux-b9d9cf88c828d5c6071c8e8c025210d5269cb499.tar.xz |
bpf: Check the validity of max_rdwr_access for sock local storage map iterator
commit 52bd05eb7c88e1ad8541a48873188ccebca9da26 upstream.
The value of sock local storage map is writable in map iterator, so check
max_rdwr_access instead of max_rdonly_access.
Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage map")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/r/20220810080538.1845898-6-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/bpf_sk_storage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index a25a96632064..5f773624948f 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -823,7 +823,7 @@ static int bpf_iter_attach_map(struct bpf_prog *prog, if (map->map_type != BPF_MAP_TYPE_SK_STORAGE) goto put_map; - if (prog->aux->max_rdonly_access > map->value_size) { + if (prog->aux->max_rdwr_access > map->value_size) { err = -EACCES; goto put_map; } |