From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Shuangpeng <shuangpeng.kernel@gmail.com>
Cc: keithp@keithp.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [BUG] KASAN: slab-use-after-free in dev_driver_string from chaoskey_release
Date: Mon, 8 Jun 2026 13:24:03 +0200 [thread overview]
Message-ID: <2a50158f-34ff-41ae-8899-ba2ec6d550b3@suse.com> (raw)
In-Reply-To: <257eb882-44dc-4e25-82f9-9cf9b455936d@rowland.harvard.edu>
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On 07.06.26 04:29, Alan Stern wrote:
> The simple explanation is that the chaoskey_release() routine contains
> debugging statements that reference an interface for the USB device even
> after that data structure may have been deallocated. Since they are
> merely debugging statements, the simplest solution to the problem is to
> get rid of them.
>
> That's what the patch below does. You can try it out and see if it
> works.
Hi,
correct but it misses the same issue in disconnect.
You need this one on top.
Regards
Oliver
[-- Attachment #2: 0001-usb-misc-chaoskey-fix-UAF-in-disconnect.patch --]
[-- Type: text/x-patch, Size: 1266 bytes --]
From 5864a7f4580707a39e3f5881ce31289095984dff Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Mon, 8 Jun 2026 13:20:35 +0200
Subject: [PATCH] usb: misc: chaoskey: fix UAF in disconnect
disconnect has the same issue as release.
The debug output refers to a potentially freed device.
Just remove it.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/misc/chaoskey.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index bf4d9294c7c9..0df337089618 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -222,12 +222,9 @@ static void chaoskey_disconnect(struct usb_interface *interface)
{
struct chaoskey *dev;
- usb_dbg(interface, "disconnect");
dev = usb_get_intfdata(interface);
- if (!dev) {
- usb_dbg(interface, "disconnect failed - no dev");
+ if (!dev)
return;
- }
if (dev->hwrng_registered)
hwrng_unregister(&dev->hwrng);
@@ -248,7 +245,6 @@ static void chaoskey_disconnect(struct usb_interface *interface)
mutex_unlock(&dev->lock);
mutex_unlock(&chaoskey_list_lock);
- usb_dbg(interface, "disconnect done");
}
static int chaoskey_open(struct inode *inode, struct file *file)
--
2.54.0
next prev parent reply other threads:[~2026-06-08 11:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 1:31 [BUG] KASAN: slab-use-after-free in dev_driver_string from chaoskey_release Shuangpeng
2026-06-07 2:29 ` Alan Stern
2026-06-07 19:37 ` Shuangpeng
2026-06-08 11:24 ` Oliver Neukum [this message]
2026-06-08 13:29 ` Alan Stern
2026-06-08 15:11 ` Johan Hovold
2026-06-08 16:03 ` Alan Stern
2026-06-09 15:54 ` Shuangpeng
2026-06-08 14:10 ` Johan Hovold
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=2a50158f-34ff-41ae-8899-ba2ec6d550b3@suse.com \
--to=oneukum@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuangpeng.kernel@gmail.com \
--cc=stern@rowland.harvard.edu \
/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