From: sashiko-bot@kernel.org
To: "Yannick Müller" <mail@ynnk.dev>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] HID: usbhid: drop pending output reports in usbhid_stop()
Date: Fri, 27 Nov 2026 08:56:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-236925@kernel.org> (raw)
In-Reply-To: <20261127084612.222563-1-mail@ynnk.dev>
> Each entry of the queue (usbhid->out[]) points to the
> struct hid_report it was built from. The queue lives in struct
> usbhid_device, which exists as long as usbhid is bound to the USB
> interface. The reports only live as long as one HID driver binding:
> hid_device_remove() frees them with hid_close_report() right after the
> driver has stopped the device.
>
> usbhid_stop() empties the control queue but not the output queue, and
> usbhid_start() does not reset it. Output reports that are still queued
> when the HID driver is unbound, for example because the device has not
> completed its interrupt-OUT transfers, therefore survive a rebind. The
> first output report after the next usbhid_start() restarts the queue at
> the old tail. hid_submit_out() then reads the stale report which
> at this point has already been freed resulting in a use-after-free.
>
> Drain the output queue in usbhid_stop() along with the control queue.
> Make hid_irq_out() leave outtail alone when the queue is already empty,
> so that the completion of the URB killed right afterwards cannot move
> outtail past outhead.
>
> Fixes: a7197c2e4120 ("HID: Handle driver-specific device descriptor in core")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yannick Müller <mail@ynnk.dev>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127084612.222563-1-mail@ynnk.dev?part=1
prev parent reply other threads:[~2026-11-27 8:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 8:45 [PATCH] HID: usbhid: drop pending output reports in usbhid_stop() Yannick Müller
2026-11-27 8:56 ` sashiko-bot [this message]
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=sashiko-outbox-236925@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@ynnk.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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