Skip to content

Commit

Permalink
hyperv: NULL dereference on error
Browse files Browse the repository at this point in the history
We try to call free_netvsc_device(net_device) when "net_device" is NULL.
It leads to an Oops.

Fixes: f90251c ('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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Sep 6, 2014
1 parent a77f9a2 commit b1c8492
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b1c8492

Please sign in to comment.