public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: shitao <shitao@kylinos.cn>
Cc: zaitcev@redhat.com, linux-usb@vger.kernel.org
Subject: Re: [PATH v2] usb: usblp: add the reset_resume function interface
Date: Tue, 17 Mar 2026 14:28:44 +0100	[thread overview]
Message-ID: <2026031730-fanatic-alias-3d85@gregkh> (raw)
In-Reply-To: <20260317125614.3215254-1-shitao@kylinos.cn>

On Tue, Mar 17, 2026 at 08:56:14PM +0800, shitao wrote:
> Add reset_resume callback to prevent premature device unbinding during
> S4 (hibernation) thaw phase, which would otherwise cause usblp to require
> a re-probe — a process that is slow and trigger error -517, and even
> has a high probability of causing use-after-free bugs and kernel panics.
> 
> Problem:
> When a USB printer(CH340S USB-to-parallel adapter ID 1a86:7584)
> is connected during S4 hibernation,the following sequence occurs:
> 
> 1. During thaw phase, USB core sets udev->reset_resume = 1
> 2. usb_resume_interface() checks for driver->reset_resume callback
> 3. If not implemented, interface is marked as needs_binding=1
> 4. usb_resume() calls unbind_marked_interfaces()
> 5. This forces disconnect via usb_forced_unbind_intf()
> 6. usblp_disconnect() immediately frees usblp structure if !usblp->used
> 7. However, PM subsystem still has references (usage_count > 0)
> 8. Subsequent PM callbacks access freed memory (0x6b6b6b6b SLAB poison)
> 9. Result: kernel panic in pm_op() with use-after-free
> 
> The bug manifests as:
> Unable to handle kernel paging request at virtual address 006b6b6b6b6b6b93
> pc : pm_op+0x50/0x80
> Call trace:
> pm_op+0x50/0x80
> dpm_resume+0xdc/0x200
> hibernation_snapshot+0x234/0x3d8
> 
> Signed-off-by: shitao <shitao@kylinos.cn>
> ---
>  drivers/usb/class/usblp.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- It looks like you did not use your "real" name for the patch on either
  the Signed-off-by: line, or the From: line (both of which have to
  match).  Please read the kernel file,
  Documentation/process/submitting-patches.rst for how to do this
  correctly.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

  reply	other threads:[~2026-03-17 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 12:56 [PATH v2] usb: usblp: add the reset_resume function interface shitao
2026-03-17 13:28 ` Greg KH [this message]
2026-03-17 14:14   ` Oliver Neukum
2026-03-17 14:06 ` Alan Stern
2026-03-17 14:35   ` Oliver Neukum
2026-03-17 16:38     ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026031730-fanatic-alias-3d85@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shitao@kylinos.cn \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox