]> git.baikalelectronics.ru Git - kernel.git/commitdiff
hv/netvsc: Fix NULL dereference at single queue mode fallback
authorTakashi Iwai <tiwai@suse.de>
Tue, 14 Aug 2018 17:10:50 +0000 (19:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Aug 2018 17:24:12 +0000 (10:24 -0700)
The recent commit d2b9666c050d ("hv/netvsc: fix handling of fallback
to single queue mode") tried to fix the fallback behavior to a single
queue mode, but it changed the function to return zero incorrectly,
while the function should return an object pointer.  Eventually this
leads to a NULL dereference at the callers that expect non-NULL
value.

Fix it by returning the proper net_device object.

Fixes: d2b9666c050d ("hv/netvsc: fix handling of fallback to single queue mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/rndis_filter.c

index 408ece27131c4611a8600028831f10aa8b47ed60..2a5209f23f296a8036c8aafd8248cc71a1582d23 100644 (file)
@@ -1338,7 +1338,7 @@ out:
        /* setting up multiple channels failed */
        net_device->max_chn = 1;
        net_device->num_chn = 1;
-       return 0;
+       return net_device;
 
 err_dev_remv:
        rndis_filter_device_remove(dev, net_device);