diff options
author | Johan Hovold <jhovold@gmail.com> | 2014-05-26 13:23:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-27 18:04:09 -0400 |
commit | 703df3297fb1950b0aa53e656108eb936d3f21d9 (patch) | |
tree | 009c2cf915a37af41b63c3226886cf027b162e5f | |
parent | 183a45087d126d126e8dd1d9b2602fc129dff9ad (diff) |
USB: cdc-acm: fix open and suspend race
We must not do the usb_autopm_put_interface() before submitting the read
urbs or we might end up doing I/O to a suspended device.
Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing")
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index c255e77282ad..74df311c8505 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -528,19 +528,15 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
528 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { | 528 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { |
529 | dev_err(&acm->control->dev, | 529 | dev_err(&acm->control->dev, |
530 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); | 530 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); |
531 | usb_autopm_put_interface(acm->control); | ||
532 | goto error_submit_urb; | 531 | goto error_submit_urb; |
533 | } | 532 | } |
534 | 533 | ||
535 | acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS; | 534 | acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS; |
536 | if (acm_set_control(acm, acm->ctrlout) < 0 && | 535 | if (acm_set_control(acm, acm->ctrlout) < 0 && |
537 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) { | 536 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) { |
538 | usb_autopm_put_interface(acm->control); | ||
539 | goto error_set_control; | 537 | goto error_set_control; |
540 | } | 538 | } |
541 | 539 | ||
542 | usb_autopm_put_interface(acm->control); | ||
543 | |||
544 | /* | 540 | /* |
545 | * Unthrottle device in case the TTY was closed while throttled. | 541 | * Unthrottle device in case the TTY was closed while throttled. |
546 | */ | 542 | */ |
@@ -552,6 +548,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
552 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) | 548 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) |
553 | goto error_submit_read_urbs; | 549 | goto error_submit_read_urbs; |
554 | 550 | ||
551 | usb_autopm_put_interface(acm->control); | ||
552 | |||
555 | mutex_unlock(&acm->mutex); | 553 | mutex_unlock(&acm->mutex); |
556 | 554 | ||
557 | return 0; | 555 | return 0; |
@@ -562,6 +560,7 @@ error_submit_read_urbs: | |||
562 | error_set_control: | 560 | error_set_control: |
563 | usb_kill_urb(acm->ctrlurb); | 561 | usb_kill_urb(acm->ctrlurb); |
564 | error_submit_urb: | 562 | error_submit_urb: |
563 | usb_autopm_put_interface(acm->control); | ||
565 | error_get_interface: | 564 | error_get_interface: |
566 | disconnected: | 565 | disconnected: |
567 | mutex_unlock(&acm->mutex); | 566 | mutex_unlock(&acm->mutex); |