Linux USB
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oneukum@suse.com>,
	Shuangpeng <shuangpeng.kernel@gmail.com>,
	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 17:11:27 +0200	[thread overview]
Message-ID: <aibbn1858ZUIq6Fq@hovoldconsulting.com> (raw)
In-Reply-To: <67613cb1-acaa-4870-93ed-95a282a74f06@rowland.harvard.edu>

On Mon, Jun 08, 2026 at 09:29:23AM -0400, Alan Stern wrote:

> You're partly right.  Both my original patch and yours ignored the fact 
> that the driver takes a reference to the interface structure.  That 
> reference isn't dropped until chaoskey_free() runs, so the only 
> debugging statements that need to be removed are the ones following 
> calls to chaoskey_free().

> Index: usb-devel/drivers/usb/misc/chaoskey.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/misc/chaoskey.c
> +++ usb-devel/drivers/usb/misc/chaoskey.c
> @@ -248,7 +248,6 @@ static void chaoskey_disconnect(struct u
>  		mutex_unlock(&dev->lock);
>  
>  	mutex_unlock(&chaoskey_list_lock);
> -	usb_dbg(interface, "disconnect done");

There is no need to remove this one as driver core holds a reference to
the interface until after disconnect() returns.

>  }
>  
>  static int chaoskey_open(struct inode *inode, struct file *file)
> @@ -320,7 +319,6 @@ bail:
>  	mutex_unlock(&dev->lock);
>  destruction:
>  	mutex_unlock(&chaoskey_list_lock);
> -	usb_dbg(interface, "release success");
>  	return rv;
>  }

Johan

  reply	other threads:[~2026-06-08 15:11 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
2026-06-08 13:29     ` Alan Stern
2026-06-08 15:11       ` Johan Hovold [this message]
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=aibbn1858ZUIq6Fq@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keithp@keithp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --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