Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628907 > unrolled thread

[PATCH 1/1] lwtunnel: check return value of nla_nest_start

Started byPan Bian <bianpan2016@163.com>
First post2017-04-23 08:30 +0200
Last post2017-04-24 22:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] lwtunnel: check return value of nla_nest_start Pan Bian <bianpan2016@163.com> - 2017-04-23 08:30 +0200
    Re: [PATCH 1/1] lwtunnel: check return value of nla_nest_start David Miller <davem@davemloft.net> - 2017-04-24 22:00 +0200

#1628907 — [PATCH 1/1] lwtunnel: check return value of nla_nest_start

FromPan Bian <bianpan2016@163.com>
Date2017-04-23 08:30 +0200
Subject[PATCH 1/1] lwtunnel: check return value of nla_nest_start
Message-ID<tzjbX-4Ry-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1629928

FromDavid Miller <davem@davemloft.net>
Date2017-04-24 22:00 +0200
Message-ID<tzSjo-2Lp-27@gated-at.bofh.it>
In reply to#1628907
From: Pan Bian <bianpan2016@163.com>
Date: Sun, 23 Apr 2017 14:28:37 +0800

> 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>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web