summaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-09-04 13:11:23 +0200
committerDavid S. Miller <davem@davemloft.net>2014-09-06 02:29:22 +0200
commitb1c849276b5e199f94501101c07ee9cb6ced4935 (patch)
tree573b7e5e189ea21351232bef5a611264136138bc /drivers/net/hyperv
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsh... (diff)
downloadlinux-b1c849276b5e199f94501101c07ee9cb6ced4935.tar.xz
linux-b1c849276b5e199f94501101c07ee9cb6ced4935.zip
hyperv: NULL dereference on error
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r--drivers/net/hyperv/netvsc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 5b5644a2233c..977984bc238a 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;