Thread (3 messages) flat view 3 messages, 3 authors, 2019-07-27

Re: [PATCH 1/2] net: ipv4: Fix a possible null-pointer dereference in inet_csk_rebuild_route()

From: David Miller <davem@davemloft.net>
Date: 2019-07-27 20:25:13
Also in: lkml

From: Jia-Ju Bai <redacted>
Date: Fri, 26 Jul 2019 10:25:34 +0800
quoted hunk ↗ jump to hunk
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index f5c163d4771b..27d9d80f3401 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1073,7 +1073,10 @@ static struct dst_entry *inet_csk_rebuild_route(struct sock *sk, struct flowi *f
 		sk_setup_caps(sk, &rt->dst);
 	rcu_read_unlock();
 
-	return &rt->dst;
+	if (rt)
+		return &rt->dst;
+	else
+		return NULL;
If rt is NULL, &rt->dst is also NULL as has been pointed out to you.

Please fix your automated tools to understand this case before submitting
more changes.

Thank you.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help