Skip to content

Commit 6e22e3a

Browse files
XidianGeneralgregkh
authored andcommitted
usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt()
wdm_in_callback() is a completion handler function for the USB driver. So it should not sleep. But it calls service_outstanding_interrupt(), which calls usb_submit_urb() with GFP_KERNEL. To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bc8acc2 commit 6e22e3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/class/cdc-wdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc)
460460

461461
set_bit(WDM_RESPONDING, &desc->flags);
462462
spin_unlock_irq(&desc->iuspin);
463-
rv = usb_submit_urb(desc->response, GFP_KERNEL);
463+
rv = usb_submit_urb(desc->response, GFP_ATOMIC);
464464
spin_lock_irq(&desc->iuspin);
465465
if (rv) {
466466
dev_err(&desc->intf->dev,

0 commit comments

Comments
 (0)