diff options
author | Rupesh Gujare <rupesh.gujare@atmel.com> | 2013-08-22 16:38:48 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-22 17:15:55 (GMT) |
commit | 0a7bfbffbd9a94a31a4bac7e9ec29d18adc8e198 (patch) | |
tree | b0a723662a6cc4251b41a913df4775cc4e851c50 /drivers/staging | |
parent | acb8d4056a5351748015464b1c551fcd310014ba (diff) | |
download | linux-0a7bfbffbd9a94a31a4bac7e9ec29d18adc8e198.tar.xz |
staging: ozwpan: Fix crash for race condition.
Do not allocate a port to new device or process URB when its status is
yet to be read. This avoids race condition when USB core read hub
status a bit late, while new device tries to acquire port.
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/ozwpan/ozhcd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index 2b67107..4682d78 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c @@ -685,7 +685,7 @@ struct oz_port *oz_hcd_pd_arrived(void *hpd) struct oz_port *port = &ozhcd->ports[i]; spin_lock(&port->port_lock); - if (!(port->flags & OZ_PORT_F_PRESENT)) { + if (!(port->flags & (OZ_PORT_F_PRESENT | OZ_PORT_F_CHANGED))) { oz_acquire_port(port, hpd); spin_unlock(&port->port_lock); break; @@ -1818,7 +1818,8 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, port = &ozhcd->ports[port_ix]; if (port == NULL) return -EPIPE; - if ((port->flags & OZ_PORT_F_PRESENT) == 0) { + if (!(port->flags & OZ_PORT_F_PRESENT) || + (port->flags & OZ_PORT_F_CHANGED)) { oz_dbg(ON, "Refusing URB port_ix = %d devnum = %d\n", port_ix, urb->dev->devnum); return -EPIPE; |