From: Stephen Hemminger <stephen@networkplumber.org>
To: pshelar@ovn.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, dev@openvswitch.org,
Stephen Hemminger <sthemmin@microsoft.com>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH net 1/2] openvswitch: check for null return for nla_nest_start
Date: Wed, 18 Jul 2018 09:12:15 -0700 [thread overview]
Message-ID: <20180718161216.27820-2-sthemmin@microsoft.com> (raw)
In-Reply-To: <20180718161216.27820-1-sthemmin@microsoft.com>
The call to nla_nest_start in conntrack can lead to a NULL
return so it's possible for attr to become NULL and we can potentially
get a NULL pointer dereference on attr. Fix this by checking for
a NULL return.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200533
Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
net/openvswitch/conntrack.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 284aca2a252d..2e316f641df8 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -2132,6 +2132,8 @@ static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(reply);
nla_reply = nla_nest_start(reply, OVS_CT_LIMIT_ATTR_ZONE_LIMIT);
+ if (!nla_reply)
+ return PRT_ERR(-EMSGSIZE);
if (a[OVS_CT_LIMIT_ATTR_ZONE_LIMIT]) {
err = ovs_ct_limit_get_zone_limit(
--
2.18.0
next prev parent reply other threads:[~2018-07-18 16:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 16:12 [PATCH net 0/2] openvswitch tests for nla_nest_start Stephen Hemminger
2018-07-18 16:12 ` Stephen Hemminger [this message]
[not found] ` <20180718161216.27820-2-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
2018-07-19 6:49 ` [PATCH net 1/2] openvswitch: check for null return " Pravin Shelar
2018-07-18 16:12 ` [PATCH net 2/2] openvswitch: check for null return for nla_nest_start in datapath Stephen Hemminger
[not found] ` <20180718161216.27820-3-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
2018-07-19 6:49 ` Pravin Shelar
2018-07-20 19:15 ` [PATCH net 0/2] openvswitch tests for nla_nest_start David Miller
2018-07-20 19:19 ` 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=20180718161216.27820-2-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
--cc=sthemmin@microsoft.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