diff options
author | Martin KaFai Lau <kafai@fb.com> | 2020-03-04 17:34:54 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-03-05 14:15:49 -0800 |
commit | 849b4d94582a966ecb533448415462846da1f0fa (patch) | |
tree | 05c047714baaed5bea5da823c7d391ea3f00185b | |
parent | 8e5290e710f4ffe8e9f8813e2ed0397a94d7b2f1 (diff) | |
download | linux-849b4d94582a966ecb533448415462846da1f0fa.tar.gz linux-849b4d94582a966ecb533448415462846da1f0fa.tar.bz2 linux-849b4d94582a966ecb533448415462846da1f0fa.zip |
bpf: Do not allow map_freeze in struct_ops map
struct_ops map cannot support map_freeze. Otherwise, a struct_ops
cannot be unregistered from the subsystem.
Fixes: 85d33df357b6 ("bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200305013454.535397-1-kafai@fb.com
-rw-r--r-- | kernel/bpf/syscall.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index a91ad518c050..0c7fb0d4836d 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1510,6 +1510,11 @@ static int map_freeze(const union bpf_attr *attr) if (IS_ERR(map)) return PTR_ERR(map); + if (map->map_type == BPF_MAP_TYPE_STRUCT_OPS) { + fdput(f); + return -ENOTSUPP; + } + mutex_lock(&map->freeze_mutex); if (map->writecnt) { |