diff options
author | John Fastabend <john.fastabend@gmail.com> | 2019-07-19 10:29:20 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-07-22 16:04:17 +0200 |
commit | 2bb90e5cc90e1d09f631aeab041a9cf913a5bbe5 (patch) | |
tree | 2bd6fddc5a229ea3926fffc1fa4841a16f45ad9d /net | |
parent | 45a4521dcbd92e71c9e53031b40e34211d3b4feb (diff) | |
download | linux-2bb90e5cc90e1d09f631aeab041a9cf913a5bbe5.tar.gz linux-2bb90e5cc90e1d09f631aeab041a9cf913a5bbe5.tar.bz2 linux-2bb90e5cc90e1d09f631aeab041a9cf913a5bbe5.zip |
bpf: sockmap, synchronize_rcu before free'ing map
We need to have a synchronize_rcu before free'ing the sockmap because
any outstanding psock references will have a pointer to the map and
when they use this could trigger a use after free.
Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock_map.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 28702f2e9a4a..56bcabe7c2f2 100644 --- a/net/core/sock_map.c +++ b/net/core/sock_map.c @@ -247,6 +247,8 @@ static void sock_map_free(struct bpf_map *map) raw_spin_unlock_bh(&stab->lock); rcu_read_unlock(); + synchronize_rcu(); + bpf_map_area_free(stab->sks); kfree(stab); } |