netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: jesse@nicira.com
Cc: netdev@vger.kernel.org, dev@openvswitch.org
Subject: [PATCH] ovs: queue_userspace_packet: bail out if nla_nest_start returns NULL
Date: Wed,  3 Jul 2013 10:49:57 +0200	[thread overview]
Message-ID: <1372841397-10873-1-git-send-email-dborkman@redhat.com> (raw)

The return value of nla_nest_start() is not checked, and can be NULL,
which is then being dereferenced in nla_nest_end(). Add a check to
prevent such situations.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 On top of "net-next" tree.

 net/openvswitch/datapath.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index d12d6b8..51a3c66 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -427,6 +427,10 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
 	upcall->dp_ifindex = dp_ifindex;
 
 	nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_KEY);
+	if (unlikely(!nla)) {
+		err = -ENOMEM;
+		goto out;
+	}
 	ovs_flow_to_nlattrs(upcall_info->key, user_skb);
 	nla_nest_end(user_skb, nla);
 
-- 
1.7.11.7

             reply	other threads:[~2013-07-03  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  8:49 Daniel Borkmann [this message]
2013-07-03 16:32 ` [PATCH] ovs: queue_userspace_packet: bail out if nla_nest_start returns NULL Jesse Gross
2013-07-03 17:13   ` Daniel Borkmann

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=1372841397-10873-1-git-send-email-dborkman@redhat.com \
    --to=dborkman@redhat.com \
    --cc=dev@openvswitch.org \
    --cc=jesse@nicira.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).