lkml.org 
[lkml]   [2020]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check
Date
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
\
 
 \ /
  Last update: 2020-07-27 05:38    [W:0.099 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site