mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
rndis_host: fix oops when query for OID_GEN_PHYSICAL_MEDIUM fails
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 039ee17d1b
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>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
b1186dee3e
commit
9f5e60dd5f
1 changed files with 6 additions and 3 deletions
|
@ -283,7 +283,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
|
||||||
struct rndis_set_c *set_c;
|
struct rndis_set_c *set_c;
|
||||||
struct rndis_halt *halt;
|
struct rndis_halt *halt;
|
||||||
} u;
|
} u;
|
||||||
u32 tmp, *phym;
|
u32 tmp, phym_unspec, *phym;
|
||||||
int reply_len;
|
int reply_len;
|
||||||
unsigned char *bp;
|
unsigned char *bp;
|
||||||
|
|
||||||
|
@ -363,12 +363,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
|
||||||
goto halt_fail_and_release;
|
goto halt_fail_and_release;
|
||||||
|
|
||||||
/* Check physical medium */
|
/* Check physical medium */
|
||||||
|
phym = NULL;
|
||||||
reply_len = sizeof *phym;
|
reply_len = sizeof *phym;
|
||||||
retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
|
retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
|
||||||
0, (void **) &phym, &reply_len);
|
0, (void **) &phym, &reply_len);
|
||||||
if (retval != 0)
|
if (retval != 0 || !phym) {
|
||||||
/* OID is optional so don't fail here. */
|
/* 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) &&
|
if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
|
||||||
*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
|
*phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
|
||||||
if (netif_msg_probe(dev))
|
if (netif_msg_probe(dev))
|
||||||
|
|
Loading…
Reference in a new issue