Commit 8c95e940 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Kleber Sacilotto de Souza

usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt()

BugLink: https://bugs.launchpad.net/bugs/1798587

commit 6e22e3af upstream.

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: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 93d775bd
...@@ -453,7 +453,7 @@ static int clear_wdm_read_flag(struct wdm_device *desc) ...@@ -453,7 +453,7 @@ static int clear_wdm_read_flag(struct wdm_device *desc)
set_bit(WDM_RESPONDING, &desc->flags); set_bit(WDM_RESPONDING, &desc->flags);
spin_unlock_irq(&desc->iuspin); spin_unlock_irq(&desc->iuspin);
rv = usb_submit_urb(desc->response, GFP_KERNEL); rv = usb_submit_urb(desc->response, GFP_ATOMIC);
spin_lock_irq(&desc->iuspin); spin_lock_irq(&desc->iuspin);
if (rv) { if (rv) {
dev_err(&desc->intf->dev, dev_err(&desc->intf->dev,
......
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