Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1c84927 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

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: f90251c8 ('hyperv: Increase the buffer length for netvsc_channel_cb()')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a77f9a28
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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;