Skip to content

Commit 0afccd7

Browse files
oneukumgregkh
authored andcommitted
cdc-acm: close race betrween suspend() and acm_softint
Suspend increments a counter, then kills the URBs, then kills the scheduled work. The scheduled work, however, may reschedule the URBs. Fix this by having the work check the counter. Signed-off-by: Oliver Neukum <[email protected]> Cc: stable <[email protected]> Tested-by: Jonas Karlsson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f6cc609 commit 0afccd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/class/cdc-acm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,14 +557,14 @@ static void acm_softint(struct work_struct *work)
557557
struct acm *acm = container_of(work, struct acm, work);
558558

559559
if (test_bit(EVENT_RX_STALL, &acm->flags)) {
560-
if (!(usb_autopm_get_interface(acm->data))) {
560+
smp_mb(); /* against acm_suspend() */
561+
if (!acm->susp_count) {
561562
for (i = 0; i < acm->rx_buflimit; i++)
562563
usb_kill_urb(acm->read_urbs[i]);
563564
usb_clear_halt(acm->dev, acm->in);
564565
acm_submit_read_urbs(acm, GFP_KERNEL);
565-
usb_autopm_put_interface(acm->data);
566+
clear_bit(EVENT_RX_STALL, &acm->flags);
566567
}
567-
clear_bit(EVENT_RX_STALL, &acm->flags);
568568
}
569569

570570
if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags))

0 commit comments

Comments
 (0)