Skip to contentSkip to conversation

hyperv: NULL dereference on error

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 4, 2014 – Sep 6, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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()')
drivers/net/hyperv/netvsc.c +2 -4
index 5b5644a..977984b 100644
@@ -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;
 
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Thu, 4 Sep 2014 14:11:23 +0300

Quoted 5 lines

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()')

Applied, thanks Dan.