mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check
@ 2020-07-27  3:38 Gaurav Singh
  2020-07-27  5:18 ` kernel test robot
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Gaurav Singh @ 2020-07-27  3:38 UTC (permalink / raw)
  To: gaurav1086, David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
	Jakub Kicinski, open list:NETWORKING [IPv4/IPv6],
	open list

ipv6_pinfo is initlialized by inet6_sk() which returns NULL. 
Hence it can cause segmentation fault. Fix this by adding a 
NULL check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 net/ipv6/ip6_output.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 8a8c2d0cfcc8..7c077a6847e4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -181,10 +181,10 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
 
 bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np)
 {
-	if (!np->autoflowlabel_set)
-		return ip6_default_np_autolabel(net);
-	else
+	if (np && np->autoflowlabel_set)
 		return np->autoflowlabel;
+	else
+		ip6_default_np_autolabel(net);
 }
 
 /*
-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-08 17:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  3:38 [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check Gaurav Singh
2020-07-27  5:18 ` kernel test robot
2020-07-27 10:34 ` kernel test robot
2020-07-27 18:39 ` David Miller
2020-07-27 19:50 ` Cong Wang
2020-07-28  2:13 ` Gaurav Singh
2020-07-28  3:12   ` Cong Wang
2020-07-28 14:41     ` Eric Dumazet
2020-08-08 17:06   ` Gaurav Singh
2020-08-08 17:37     ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®