summaryrefslogtreecommitdiff
path: root/include/net/inet_sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-10-01 15:02:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-18 09:16:20 +0200
commit17af5475aef350b78875646b2795381f452de756 (patch)
tree5c5776d530109d71ef733aceb6be0072db5648f2 /include/net/inet_sock.h
parent4b7b26024f52a5cdeca20b56657f90d74a0a1995 (diff)
tcp/dccp: fix lockdep issue when SYN is backlogged
[ Upstream commit 1ad98e9d1bdf4724c0a8532fabd84bf3c457c2bc ] In normal SYN processing, packets are handled without listener lock and in RCU protected ingress path. But syzkaller is known to be able to trick us and SYN packets might be processed in process context, after being queued into socket backlog. In commit 06f877d613be ("tcp/dccp: fix other lockdep splats accessing ireq_opt") I made a very stupid fix, that happened to work mostly because of the regular path being RCU protected. Really the thing protecting ireq->ireq_opt is RCU read lock, and the pseudo request refcnt is not relevant. This patch extends what I did in commit 449809a66c1d ("tcp/dccp: block BH for SYN processing") by adding an extra rcu_read_{lock|unlock} pair in the paths that might be taken when processing SYN from socket backlog (thus possibly in process context) Fixes: 06f877d613be ("tcp/dccp: fix other lockdep splats accessing ireq_opt") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r--include/net/inet_sock.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 8e51b4a69088..1035525a4c11 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -131,8 +131,7 @@ static inline int inet_request_bound_dev_if(const struct sock *sk,
static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq)
{
- return rcu_dereference_check(ireq->ireq_opt,
- refcount_read(&ireq->req.rsk_refcnt) > 0);
+ return rcu_dereference(ireq->ireq_opt);
}
struct inet_cork {