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

* Re: [PATCH] hv/netvsc: Fix NULL dereference at single queue mode fallback
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-08-14 17:18 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Stephen Hemminger, K . Y . Srinivasan, Haiyang Zhang,
	David S . Miller, devel, netdev

On Tue, 14 Aug 2018 19:10:50 +0200
Takashi Iwai <tiwai@suse.de> wrote:

> 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>

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH] hv/netvsc: Fix NULL dereference at single queue mode fallback
  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
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2018-08-14 17:29 UTC (permalink / raw)
  To: tiwai; +Cc: sthemmin, kys, haiyangz, devel, netdev

From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 14 Aug 2018 19:10:50 +0200

> 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")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Applied and queued up for -stable.

Please do not put explicit "CC: stable" notations in networking patches, I queue
up and submit networking patches to -stable explicitly.

Thank you.

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

* Re: [PATCH] hv/netvsc: Fix NULL dereference at single queue mode fallback
  2018-08-14 17:29 ` David Miller
@ 2018-08-14 17:47   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-08-14 17:47 UTC (permalink / raw)
  To: David Miller; +Cc: sthemmin, kys, haiyangz, devel, netdev

On Tue, 14 Aug 2018 19:29:32 +0200,
David Miller wrote:
> 
> From: Takashi Iwai <tiwai@suse.de>
> Date: Tue, 14 Aug 2018 19:10:50 +0200
> 
> > 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")
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> 
> Applied and queued up for -stable.
> 
> Please do not put explicit "CC: stable" notations in networking patches, I queue
> up and submit networking patches to -stable explicitly.

OK, noted for the next time.  Thanks!


Takashi

^ permalink raw reply	[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).