diff options
author | John Fastabend <john.fastabend@gmail.com> | 2019-07-19 19:29:19 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-07-22 16:04:17 +0200 |
commit | 45a4521dcbd92e71c9e53031b40e34211d3b4feb (patch) | |
tree | 08c6b20c0f3f00de939f03be1d6f57e941e78ae3 /net/mac80211/mesh_hwmp.c | |
parent | net/tls: fix transition through disconnect with close (diff) | |
download | linux-45a4521dcbd92e71c9e53031b40e34211d3b4feb.tar.xz linux-45a4521dcbd92e71c9e53031b40e34211d3b4feb.zip |
bpf: sockmap, sock_map_delete needs to use xchg
__sock_map_delete() may be called from a tcp event such as unhash or
close from the following trace,
tcp_bpf_close()
tcp_bpf_remove()
sk_psock_unlink()
sock_map_delete_from_link()
__sock_map_delete()
In this case the sock lock is held but this only protects against
duplicate removals on the TCP side. If the map is free'd then we have
this trace,
sock_map_free
xchg() <- replaces map entry
sock_map_unref()
sk_psock_put()
sock_map_del_link()
The __sock_map_delete() call however uses a read, test, null over the
map entry which can result in both paths trying to free the map
entry.
To fix use xchg in TCP paths as well so we avoid having two references
to the same map entry.
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/mac80211/mesh_hwmp.c')
0 files changed, 0 insertions, 0 deletions