aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2019-06-11 17:45:57 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2019-06-12 10:38:20 -0400
commitf12dd75959b0138f94da8ddcf43f2f3cf277216d (patch)
treef855d145e55a98bc81e747f916df42bf43577b84
parentda2577fdd0932ea4eefe73903f1130ee366767d2 (diff)
bpf: net: Set sk_bpf_storage back to NULL for cloned sk
The cloned sk should not carry its parent-listener's sk_bpf_storage. This patch fixes it by setting it back to NULL. Fixes: 6ac99e8f23d4 ("bpf: Introduce bpf sk local storage") Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--net/core/sock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 2b3701958486..d90fd04622e5 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1850,6 +1850,9 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1850 goto out; 1850 goto out;
1851 } 1851 }
1852 RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL); 1852 RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL);
1853#ifdef CONFIG_BPF_SYSCALL
1854 RCU_INIT_POINTER(newsk->sk_bpf_storage, NULL);
1855#endif
1853 1856
1854 newsk->sk_err = 0; 1857 newsk->sk_err = 0;
1855 newsk->sk_err_soft = 0; 1858 newsk->sk_err_soft = 0;