Skip to content

cdc-acm: fix incorrect runtime wakeup in acm_tty_write

Zhang, Yanmin lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 1 replyIn review
  2. v23 patches 2 repliesSuperseded
  3. v13 patches 2 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3usb: add function usb_autopm_get_interface_upgradedrivers/usb/core/driver.c include/linux/usb.h+57 -00 replies
2/3cdc-acm: call usb_autopm_get_interface_upgrade in acm_tty_writedrivers/usb/class/cdc-acm.c+6 -70 replies
3/3n_gsm: wake up ldisc tty before using itdrivers/tty/n_gsm.c+39 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH V3 0/3] cdc-acm: fix incorrect runtime wakeup in acm_tty_write

Resend as V1/V2 have email format issue. Sorry for bothering.

I use Thunderbird. It has no a button to enable LKML email simply. :)

V3: Change email config to resend.
Add a space in comment.

---

There is a scenario about cdc-acm utilization.Application opens n_gsm tty and cdc-acm tty. cdc-acm tty connects to xhci device. The application configures cdc-adm tty to n_gsm tty as ldisc tty.

n_gsm=>cdc-acm=>xhci driver

acm_tty_write can be called from n_gsm driver by ldisc connection, and from application when application opens cdc-acm tty directly. acm_tty_write wakes up the device by calling usb_autopm_get_interface_async, which calls pm_runtime_get. However, pm_runtime_get can't wake up the device before returning as it's an async wake up. Then, acm_tty_write might access the device when it is off.

The patchset fixes it by:
1) add a new function usb_autopm_get_interface_upgrade to deal with above 2 requirements;
2) wake up device in n_gsm driver if n_gsm drivers calls cdc-acm driver;