From: Manjeet Pawar <manjeet.p@samsung.com>
To: davem@davemloft.net, kuznet@ms2.inr.ac.ru, jmorris@namei.org,
yoshfuji@linux-ipv6.org, kaber@trash.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: pankaj.m@samsung.com, ajeet.y@samsung.com,
Rohit Thapliyal <r.thapliyal@samsung.com>,
Manjeet Pawar <manjeet.p@samsung.com>,
Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: [PATCH v2] ipv6:ipv6_pinfo dereferenced after NULL check
Date: Thu, 24 Nov 2016 16:11:57 +0530 [thread overview]
Message-ID: <1479984117-39005-1-git-send-email-manjeet.p@samsung.com> (raw)
From: Rohit Thapliyal <r.thapliyal@samsung.com>
np checked for NULL and then dereferenced. It should be modified
for NULL case.
Signed-off-by: Rohit Thapliyal <r.thapliyal@samsung.com>
Signed-off-by: Manjeet Pawar <manjeet.p@samsung.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
---
v1->v2: Modified as per the suggestion of Hannes
np ? np->autoflowlabel : ip6_default_np_autolabel(net)
net/ipv6/ip6_output.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59eb4ed..d734b5e 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -215,11 +215,14 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
*/
if (np)
hlimit = np->hop_limit;
+
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
- ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
- np->autoflowlabel, fl6));
+ ip6_flow_hdr(hdr, tclass,
+ ip6_make_flowlabel(net, skb, fl6->flowlabel,
+ np ? np->autoflowlabel : ip6_default_np_autolabel(net),
+ fl6));
hdr->payload_len = htons(seg_len);
hdr->nexthdr = proto;
--
1.9.1
next reply other threads:[~2016-11-24 10:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 10:41 Manjeet Pawar [this message]
2016-11-27 20:25 ` [PATCH v2] ipv6:ipv6_pinfo dereferenced after NULL check David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479984117-39005-1-git-send-email-manjeet.p@samsung.com \
--to=manjeet.p@samsung.com \
--cc=ajeet.y@samsung.com \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pankaj.m@samsung.com \
--cc=r.thapliyal@samsung.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox