netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
@ 2008-03-17 21:33 Jussi Kivilinna
  2008-03-17 21:42 ` David Brownell
  0 siblings, 1 reply; 6+ messages in thread
From: Jussi Kivilinna @ 2008-03-17 21:33 UTC (permalink / raw)
  To: dbrownell; +Cc: dmonakhov, netdev

From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>

When query for OID_GEN_PHYSICAL_MEDIUM fails, uninitialized pointer
'phym' is being accessed in generic_rndis_bind(), resulting OOPS.
Patch fixes phym to be initialized and setup correctly when
rndis_query() for physical medium fails.

Bug was introduced by following commit:
commit 039ee17d1baabaa21783a0d5ab3e8c6d8c794bdf
Author: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Date:   Sun Jan 27 23:34:33 2008 +0200

Reported-by: Dmitri Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
---

 drivers/net/usb/rndis_host.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index a613247..1b810ab 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -287,7 +287,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
 		struct rndis_set_c	*set_c;
 		struct rndis_halt	*halt;
 	} u;
-	u32			tmp, *phym;
+	u32			tmp, phym_unspec, *phym;
 	int			reply_len;
 	unsigned char		*bp;
 
@@ -359,12 +359,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
 		goto halt_fail_and_release;
 
 	/* Check physical medium */
+	phym = NULL;
 	reply_len = sizeof *phym;
 	retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
 			0, (void **) &phym, &reply_len);
-	if (retval != 0)
+	if (retval != 0 || !phym) {
 		/* OID is optional so don't fail here. */
-		*phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
+		phym_unspec = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
+		phym = &phym_unspec;
+	}
 	if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
 			*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
 		if (netif_msg_probe(dev))


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

* Re: [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
  2008-03-17 21:33 [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails Jussi Kivilinna
@ 2008-03-17 21:42 ` David Brownell
  2008-03-17 22:02   ` Jussi Kivilinna
  2008-03-22 11:14   ` Jussi Kivilinna
  0 siblings, 2 replies; 6+ messages in thread
From: David Brownell @ 2008-03-17 21:42 UTC (permalink / raw)
  To: Jussi Kivilinna; +Cc: dmonakhov, netdev

On Monday 17 March 2008, Jussi Kivilinna wrote:
> From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
> 
> When query for OID_GEN_PHYSICAL_MEDIUM fails, uninitialized pointer
> 'phym' is being accessed in generic_rndis_bind(), resulting OOPS.
> Patch fixes phym to be initialized and setup correctly when
> rndis_query() for physical medium fails.
> 
> Bug was introduced by following commit:
> commit 039ee17d1baabaa21783a0d5ab3e8c6d8c794bdf
> Author: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
> Date:   Sun Jan 27 23:34:33 2008 +0200
> 
> Reported-by: Dmitri Monakhov <dmonakhov@openvz.org>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>

Acked-by: David Brownell <dbrownell@users.sourceforge.net>

... this should be for 2.6.25 though, yes?  Since that
change was introduced after 2.6.24, and this would
otherwise cause a regression ...


> ---
> 
>  drivers/net/usb/rndis_host.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
> index a613247..1b810ab 100644
> --- a/drivers/net/usb/rndis_host.c
> +++ b/drivers/net/usb/rndis_host.c
> @@ -287,7 +287,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
>  		struct rndis_set_c	*set_c;
>  		struct rndis_halt	*halt;
>  	} u;
> -	u32			tmp, *phym;
> +	u32			tmp, phym_unspec, *phym;
>  	int			reply_len;
>  	unsigned char		*bp;
>  
> @@ -359,12 +359,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
>  		goto halt_fail_and_release;
>  
>  	/* Check physical medium */
> +	phym = NULL;
>  	reply_len = sizeof *phym;
>  	retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
>  			0, (void **) &phym, &reply_len);
> -	if (retval != 0)
> +	if (retval != 0 || !phym) {
>  		/* OID is optional so don't fail here. */
> -		*phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
> +		phym_unspec = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
> +		phym = &phym_unspec;
> +	}
>  	if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
>  			*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
>  		if (netif_msg_probe(dev))
> 



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

* Re: [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
@ 2008-03-17 21:43 Jussi Kivilinna
  0 siblings, 0 replies; 6+ messages in thread
From: Jussi Kivilinna @ 2008-03-17 21:43 UTC (permalink / raw)
  To: dbrownell; +Cc: dmonakhov, netdev

Ofcourse topic should have started [PATCH-2.6.25] as this patch should  
go to 2.6.25.

  - Jussi Kivilinna



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

* Re: [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
  2008-03-17 21:42 ` David Brownell
@ 2008-03-17 22:02   ` Jussi Kivilinna
  2008-03-22 11:14   ` Jussi Kivilinna
  1 sibling, 0 replies; 6+ messages in thread
From: Jussi Kivilinna @ 2008-03-17 22:02 UTC (permalink / raw)
  To: David Brownell; +Cc: dmonakhov, netdev

Quoting David Brownell <david-b@pacbell.net>:

> ... this should be for 2.6.25 though, yes?  Since that
> change was introduced after 2.6.24, and this would
> otherwise cause a regression ...
>

Yes, that's right. Just after hitting enter on 'stg mail', I oops'd.



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

* Re: [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
  2008-03-17 21:42 ` David Brownell
  2008-03-17 22:02   ` Jussi Kivilinna
@ 2008-03-22 11:14   ` Jussi Kivilinna
  2008-03-22 17:58     ` David Brownell
  1 sibling, 1 reply; 6+ messages in thread
From: Jussi Kivilinna @ 2008-03-22 11:14 UTC (permalink / raw)
  To: David Brownell; +Cc: netdev

Quoting David Brownell <david-b@pacbell.net>:

> ... this should be for 2.6.25 though, yes?  Since that
> change was introduced after 2.6.24, and this would
> otherwise cause a regression ...

Should I resend patch? It hasn't got into 2.6.25 yet. Actually, who am  
I supposed to CC bugfix patches?



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

* Re: [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
  2008-03-22 11:14   ` Jussi Kivilinna
@ 2008-03-22 17:58     ` David Brownell
  0 siblings, 0 replies; 6+ messages in thread
From: David Brownell @ 2008-03-22 17:58 UTC (permalink / raw)
  To: Jussi Kivilinna; +Cc: netdev

On Saturday 22 March 2008, Jussi Kivilinna wrote:
> Quoting David Brownell <david-b@pacbell.net>:
> 
> > ... this should be for 2.6.25 though, yes?  Since that
> > change was introduced after 2.6.24, and this would
> > otherwise cause a regression ...
> 
> Should I resend patch? It hasn't got into 2.6.25 yet. Actually, who am  
> I supposed to CC bugfix patches?

A resend couldn't hurt, with a possible RC7 nearly upon us...

The folk pushing netdev patches upstream are Jeff Garzik
and David Miller.  Presumably they're like all of us, and
sometimes need nudges like direct CCs.  :)


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

end of thread, other threads:[~2008-03-22 17:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 21:33 [PATCH-2.6.26] rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails Jussi Kivilinna
2008-03-17 21:42 ` David Brownell
2008-03-17 22:02   ` Jussi Kivilinna
2008-03-22 11:14   ` Jussi Kivilinna
2008-03-22 17:58     ` David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2008-03-17 21:43 Jussi Kivilinna

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