]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap, duplicates release calls may NULL sk_prot
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 2 Apr 2018 19:50:52 +0000 (12:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 4 Apr 2018 09:04:31 +0000 (11:04 +0200)
commit711bf3da5abc26f19d8b93901f1179165c4ceb31
treedff6c545309c53c46efa7f6444ec5abe7b0c2b9e
parent79211970dc3f0825ebc4afb44891ee8a03e9413f
bpf: sockmap, duplicates release calls may NULL sk_prot

It is possible to have multiple ULP tcp_release call paths in flight
if a sock is closed and simultaneously being removed from the sockmap
control path. The result would be setting the sk_prot to the saved
values on the first iteration and then on the second iteration setting
the value to NULL.

This patch resolves this by ensuring we only reset the sk_prot pointer
if we have a valid saved state to set.

Fixes: c88bd5e53ee46 ("bpf: create tcp_bpf_ulp allowing BPF to monitor socket TX/RX data")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/sockmap.c