netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv/netvsc: Fix NULL dereference at single queue mode fallback
@ 2018-08-14 17:10 Takashi Iwai
  2018-08-14 17:18 ` Stephen Hemminger
  2018-08-14 17:29 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-08-14 17:10 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: K . Y . Srinivasan, Haiyang Zhang, David S . Miller, devel,
	netdev

The recent commit 916c5e1413be ("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: 916c5e1413be ("hv/netvsc: fix handling of fallback to single queue mode")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/net/hyperv/rndis_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 408ece27131c..2a5209f23f29 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-14 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-14 17:10 [PATCH] hv/netvsc: Fix NULL dereference at single queue mode fallback Takashi Iwai
2018-08-14 17:18 ` Stephen Hemminger
2018-08-14 17:29 ` David Miller
2018-08-14 17:47   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).