[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170717184255.6121-1-xiyou.wangcong@gmail.com>
Date: Mon, 17 Jul 2017 11:42:55 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: netdev@...r.kernel.org
Cc: dsahern@...il.com, Cong Wang <xiyou.wangcong@...il.com>,
Lawrence Brakmo <brakmo@...com>,
Daniel Borkmann <daniel@...earbox.net>
Subject: [Patch net] bpf: check NULL for sk_to_full_sk() return value
When req->rsk_listener is NULL, sk_to_full_sk() returns
NULL too, so we have to check its return value against
NULL here.
Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops")
Reported-by: David Ahern <dsahern@...il.com>
Tested-by: David Ahern <dsahern@...il.com>
Cc: Lawrence Brakmo <brakmo@...com>
Cc: Daniel Borkmann <daniel@...earbox.net>
Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
---
include/linux/bpf-cgroup.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 360c082e885c..d41d40ac3efd 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -85,7 +85,7 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
int __ret = 0; \
if (cgroup_bpf_enabled && (sock_ops)->sk) { \
typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \
- if (sk_fullsock(__sk)) \
+ if (__sk && sk_fullsock(__sk)) \
__ret = __cgroup_bpf_run_filter_sock_ops(__sk, \
sock_ops, \
BPF_CGROUP_SOCK_OPS); \
--
2.13.0
Powered by blists - more mailing lists