Commit beb1d35f authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

usb: cdc-wdm: Fix submission of URB after suspension

There's a window under which cdc-wdm may submit
an URB to a device about to be suspended. This
introduces a flag to prevent it.
Signed-off-by: default avatarOliver Neukum <neukum@b1-systems.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d855fe2e
...@@ -53,7 +53,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids); ...@@ -53,7 +53,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
#define WDM_INT_STALL 5 #define WDM_INT_STALL 5
#define WDM_POLL_RUNNING 6 #define WDM_POLL_RUNNING 6
#define WDM_RESPONDING 7 #define WDM_RESPONDING 7
#define WDM_SUSPENDING 8
#define WDM_MAX 16 #define WDM_MAX 16
...@@ -231,7 +231,8 @@ static void wdm_int_callback(struct urb *urb) ...@@ -231,7 +231,8 @@ static void wdm_int_callback(struct urb *urb)
spin_lock(&desc->iuspin); spin_lock(&desc->iuspin);
clear_bit(WDM_READ, &desc->flags); clear_bit(WDM_READ, &desc->flags);
set_bit(WDM_RESPONDING, &desc->flags); set_bit(WDM_RESPONDING, &desc->flags);
if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { if (!test_bit(WDM_DISCONNECTING, &desc->flags)
&& !test_bit(WDM_SUSPENDING, &desc->flags)) {
rv = usb_submit_urb(desc->response, GFP_ATOMIC); rv = usb_submit_urb(desc->response, GFP_ATOMIC);
dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d",
__func__, rv); __func__, rv);
...@@ -800,6 +801,7 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -800,6 +801,7 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
rv = -EBUSY; rv = -EBUSY;
} else { } else {
#endif #endif
set_bit(WDM_SUSPENDING, &desc->flags);
cancel_work_sync(&desc->rxwork); cancel_work_sync(&desc->rxwork);
kill_urbs(desc); kill_urbs(desc);
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -830,6 +832,7 @@ static int wdm_resume(struct usb_interface *intf) ...@@ -830,6 +832,7 @@ static int wdm_resume(struct usb_interface *intf)
dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor);
mutex_lock(&desc->lock); mutex_lock(&desc->lock);
rv = recover_from_urb_loss(desc); rv = recover_from_urb_loss(desc);
clear_bit(WDM_SUSPENDING, &desc->flags);
mutex_unlock(&desc->lock); mutex_unlock(&desc->lock);
return rv; return rv;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment