From: Pan Bian <bianpan2016@163.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: David Ahern <dsa@cumulusnetworks.com>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
Alexei Starovoitov <ast@kernel.org>,
David Lebrun <david.lebrun@uclouvain.be>,
Tom Herbert <tom@herbertland.com>,
Robert Shearman <rshearma@brocade.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Pan Bian <bianpan2016@163.com>
Subject: [PATCH 1/1] lwtunnel: check return value of nla_nest_start
Date: Sun, 23 Apr 2017 14:28:37 +0800 [thread overview]
Message-ID: <1492928917-25628-1-git-send-email-bianpan2016@163.com> (raw)
Function nla_nest_start() may return a NULL pointer on error. However,
in function lwtunnel_fill_encap(), the return value of nla_nest_start()
is not validated before it is used. This patch checks the return value
of nla_nest_start() against NULL.
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
net/core/lwtunnel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index 6df9f8f..3471ce7 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -216,6 +216,8 @@ int lwtunnel_fill_encap(struct sk_buff *skb, struct lwtunnel_state *lwtstate)
ret = -EOPNOTSUPP;
nest = nla_nest_start(skb, RTA_ENCAP);
+ if (!nest)
+ goto nla_put_failure;
rcu_read_lock();
ops = rcu_dereference(lwtun_encaps[lwtstate->type]);
if (likely(ops && ops->fill_encap))
--
1.9.1
next reply other threads:[~2017-04-23 6:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-23 6:28 Pan Bian [this message]
2017-04-24 19:51 ` [PATCH 1/1] lwtunnel: check return value of nla_nest_start 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=1492928917-25628-1-git-send-email-bianpan2016@163.com \
--to=bianpan2016@163.com \
--cc=ast@kernel.org \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=dsa@cumulusnetworks.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=rshearma@brocade.com \
--cc=tom@herbertland.com \
/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;
as well as URLs for NNTP newsgroup(s).