public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle•com>
To: "K. Y. Srinivasan" <kys@microsoft•com>,
	Haiyang Zhang <haiyangz@microsoft•com>
Cc: devel@linuxdriverproject•org, kernel-janitors@vger•kernel.org,
	netdev@vger•kernel.org
Subject: [patch -next] hyperv: NULL dereference on error
Date: Thu, 4 Sep 2014 14:11:23 +0300	[thread overview]
Message-ID: <20140904111123.GD21504@mwanda> (raw)

We try to call free_netvsc_device(net_device) when "net_device" is NULL.
It leads to an Oops.

Fixes: f90251c8a6d0 ('hyperv: Increase the buffer length for netvsc_channel_cb()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle•com>

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 5b5644a..977984b 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -1054,10 +1054,8 @@ int netvsc_device_add(struct hv_device *device, void *additional_info)
 	struct net_device *ndev;
 
 	net_device = alloc_net_device(device);
-	if (!net_device) {
-		ret = -ENOMEM;
-		goto cleanup;
-	}
+	if (!net_device)
+		return -ENOMEM;
 
 	net_device->ring_size = ring_size;

             reply	other threads:[~2014-09-04 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 11:11 Dan Carpenter [this message]
2014-09-06  0:29 ` [patch -next] hyperv: NULL dereference on error 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=20140904111123.GD21504@mwanda \
    --to=dan.carpenter@oracle$(echo .)com \
    --cc=devel@linuxdriverproject$(echo .)org \
    --cc=haiyangz@microsoft$(echo .)com \
    --cc=kernel-janitors@vger$(echo .)kernel.org \
    --cc=kys@microsoft$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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