From: sashiko-bot@kernel.org
To: "Hongyu Xie" <xiehongyu1@kylinos.cn>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/3] usb: core: Fix use-after-free in anchor wakeup protocol
Date: Thu, 22 Oct 2026 04:00:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-180989@kernel.org> (raw)
In-Reply-To: <179264120769.17277.3664390143604314731@kylinos.cn>
> The API contract of usb_wait_anchor_empty_timeout() and of the anchor
> cleanup helpers is that when they return successfully (non-zero, for
> usb_wait_anchor_empty_timeout()), no URB giveback is in flight for the
> anchor anymore, so drivers may free the memory holding the anchor
> (xpad, for example, embeds irq_out_anchor in its private structure and
> kfrees it in xpad_disconnect()).
>
> This contract is broken by two windows in which the waiter can observe
> "anchor list empty and suspend_wakeups == 0" while the URB giveback
> path is still about to access anchor->wait:
>
> 1. usb_anchor_resume_wakeups() decrements suspend_wakeups, which
> makes the wait condition true, and only afterwards calls
> wake_up(&anchor->wait), without any synchronization in between.
> A waiter returns, the driver frees the anchor, and the late
> [ ... ]
> Cc: stable@vger.kernel.org
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Oliver Neukum <oliver@neukum.org>
> Cc: Hans de Goede <hansg@kernel.org>
> Signed-off-by: Hongyu Xie <xiehongyu1@kylinos.cn>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179264120148.17277.68253767316647311@kylinos.cn?part=1
next prev parent reply other threads:[~2026-10-22 4:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 3:53 [PATCH 0/3] usb: core: fix three use-after-free windows in the USB anchor protocol Hongyu Xie
2026-10-22 3:53 ` [PATCH 1/3] usb: core: Fix use-after-free in anchor wakeup protocol Hongyu Xie
2026-10-22 4:00 ` sashiko-bot [this message]
2026-10-22 3:53 ` [PATCH 2/3] usb: core: Close anchor capture-to-increment race in URB giveback Hongyu Xie
2026-10-22 3:58 ` sashiko-bot
2026-10-22 3:53 ` [PATCH 3/3] usb: core: Close residual anchor read-to-lock window with RCU Hongyu Xie
2026-10-22 4:21 ` sashiko-bot
2026-10-22 17:29 ` What happened with Sashiko? Alan Stern
2026-10-22 23:07 ` Roman Gushchin
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-180989@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiehongyu1@kylinos.cn \
/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