Skip to content

Commit

Permalink
hv/netvsc: Fix NULL dereference at single queue mode fallback
Browse files Browse the repository at this point in the history
The recent commit 916c5e1 ("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: 916c5e1 ("hv/netvsc: fix handling of fallback to single queue mode")
Signed-off-by: Takashi Iwai <[email protected]>
Reviewed-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tiwai authored and davem330 committed Aug 14, 2018
1 parent 4597b62 commit b19b463
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/hyperv/rndis_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
/* 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);
Expand Down

0 comments on commit b19b463

Please sign in to comment.