Re: [PATCH v3] USB: cdc-acm: restore the line coding after a reset-resume

From: Oliver Neukum

Date: Wed Dec 02 2026 - 05:40:04 EST




On 01.12.26 17:45, Piotr Kubik wrote:
A device that loses power during system suspend comes back at its
power-on line coding. With USB persist, the USB core then resets the
device and calls acm_reset_resume(), but acm->line still holds the line
coding that the driver sent last. acm_tty_set_termios() sends
SET_LINE_CODING only when the termios differ from acm->line, so an open
with the same settings sends nothing. The port then runs at the wrong
rate until the termios change or the device is probed again.

Send the cached line coding from acm_reset_resume() of the last
interface to resume, which acm->susp_count shows, before acm_resume()
restarts the URBs. The USB core calls reset_resume for each interface in
the order of the configuration descriptor, so the control interface is
not always the last one. Send it with __acm_set_line(), a new variant of
acm_set_line() without the autopm reference, because reset_resume also
runs in a runtime resume of the device, where usb_autopm_get_interface()
would wait for that same resume and never return. Ignore the result, as
acm_probe() does, because a device without USB_CDC_CAP_LINE need not
support the request.

I saw the fault on my workstation while using serial consoles.
Claude Code agent (Opus 5.5) traced the cause to the cached
acm->line and wrote the first draft of this patch and this commit message.
It also wrote and ran the test: a QEMU guest with the adapter passed
through, and a USB power cut while the guest was in S3.
Three other Claude instances reviewed the patch, the message and the test
record. I reviewed the patch and I understand the change.

Fixes: a91b0c502285 ("cdc_acm: add reset_resume method")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Piotr Kubik <piotr@xxxxxxxx>Acked-by: Oliver Neukum <oneukum@xxxxxxxx>