From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7953D4A13B8 for ; Tue, 9 Jun 2026 15:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781020529; cv=none; b=iepj0Q8+vs2xxr4oFQhcgho6GehiTBKEVrLDha6eMCNFLC+hkfb/+EoD5a5j5sRdTc4HQ9ryTHGT3HXhK/942D2p/AYQ1pNojSIyykMPz2IY4t7v0XbaZfiffkaOPbvkUZWvhs1ci/6utWbkKx235tLfxmkFR6+iDLxh3kFLHOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781020529; c=relaxed/simple; bh=vnzgr0wZPYhLyjo5iZwwLgQCFNkCGyM2OhRSkb9N97g=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=NaBSdHVBHCsR2pPJFTP8Wx3E2uht8XjtzG4Ac17WTg9tXxpp4pVj7liyVBtXpe2E90pWm6YGHScP2LNaiRJ5g/LDrVD3rwwsjlrQFeVeBqV+8sCDGpGSjOJncUuxxdmxhDU3vivX47osUPq8wpl8wAp8bKpnXuUzs0+2K4lr9HA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jpYp8CBZ; arc=none smtp.client-ip=209.85.160.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jpYp8CBZ" Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-51784eb2ba0so43169641cf.2 for ; Tue, 09 Jun 2026 08:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781020527; x=1781625327; darn=vger.kernel.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qlG8N3aHvqiInm0r0TgXUpGKex3pN7HDqaGpiUSCyGs=; b=jpYp8CBZ8J1SSsOKiagoX0eZ3Vh8oI0ECEU4ijtaP4UwYEq6a3+8jkkMN1kHNpihXL uiVXnp6HKUUnMoeFm8OR2B1dKa73mRxRNKx6ZOGIPwmTcs+tJl7/3PxZc2p05zIvtS3C ik6yH97fjVazoHYf9DFlmQE41b1qcoyQ2Hyef9n9M6itydXDlhDS8LbZ/rjz1kzcs5zy FuPgP2WHDcrRjQp4JxbHqoSdNRkf7aVnvJQfd0hRQOZDRXtyZHBMikVeNbd+z/VAWTRr 2bBXCCfmYCNkXGwtE7BKIAw+za1u3zRsc2aO1bA33GkUZZDL+n2qwtpY9a9fHLoEOT0k USsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781020527; x=1781625327; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qlG8N3aHvqiInm0r0TgXUpGKex3pN7HDqaGpiUSCyGs=; b=nGT53fBncL1t2cbrsv4GD+w3ebG1iKshtAq9VnefGUHnjcEE2NKxlpoFRYdAf/17B2 ONHXz7Bu2cMKi4Kds4OR6aR6zjb97aV78tK5BBLYEe1PLrQfk3aWNLi5lgTdQ/zT6fNe eduHE+VW/SHUtYtEigCrosAh3Z75eT8GumY3/MnBDKFhg06ZVnd0mJ2DTskwaqaKeIP3 jhLLOTbuWl8naGoJEQh+C1+HNkUDlTDZxH9jdouSEJGiukzR9bNboVPV4d+ri3vJw5vW EV3bKG1VOrG/aOxqlb+zIgoFVZ++vsEKgDP2TORb/h8L9g4Sy/KgAYWJkughun7YsKiH Iysw== X-Forwarded-Encrypted: i=1; AFNElJ++whsqlOMDyh35sdHYDW1vgmMm/ZnWXLZzTc/iqCv1oQAoe9pyhiCvgIkvLZ49Vsbc7L376mkCT6Skf0M=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6ng/Uq/sFNgj029iS8f2vWABAqcXMo5hhxuNPcXBHCxo/SwMY 6BidWVHGmzd7n/x2YxCbIoHsc/ai8eoC4QltrZ2wSQf9QXKAF9ITPTFu X-Gm-Gg: Acq92OGcT2vC8m5/kOBgxoNsYsfRhbzDuYfVoKZM9RkM/3CxtMCCcoBdTHl4YycOgxC YxTnSFbG4JC4o+uYFZfWQQy/06Wi4nWgjGIWntEqZfoZ8DMxzQFJXBzVPJIBKx9491kZ4zSbTDy GS4UZ3TFQPgNa+GRGPjQNQRhcCOO0wM1BRvwepnDvLQEcKPYmqFIJ1xSbIwbb8ntiMGVjp60x2i 0u0+iqxdaw9bMS2FFUAaDrWAN2TQI73YIY8ZhC4VOSyWsmQVHuhG1xqB/sgW88d9dOet5R+Nwz9 9mI5xrdXdWlaITz+/QJP7S3vjhFVFBR9smLZM63fEZ3JIqeKK5ihhVSLFKC85p++nN4ddBzVSI/ n9MqIXQPvOQ4kJDTV4Ob/wA3Ydf9sCRhxWiID9snPwQY0dk6IwMhI7I7JfgSmb7A90hV4e6TB+a uUDT04DKd7RlcTKUewOtpP0bB/xQaWWvwzs/hyZQKyUd9GcjZIm+64iE5A3rgYnJ83J6Sutd4f9 JU= X-Received: by 2002:a05:622a:2517:b0:517:5e32:af23 with SMTP id d75a77b69052e-51795aebe02mr319216941cf.23.1781020527242; Tue, 09 Jun 2026 08:55:27 -0700 (PDT) Received: from smtpclient.apple ([2601:985:4601:5df0:d13d:e392:6196:91d4]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51775c07eb0sm207572981cf.5.2026.06.09.08.55.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2026 08:55:26 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [BUG] KASAN: slab-use-after-free in dev_driver_string from chaoskey_release From: Shuangpeng In-Reply-To: <0085d585-c3e8-455f-9959-b019800f08ea@rowland.harvard.edu> Date: Tue, 9 Jun 2026 11:54:55 -0400 Cc: Johan Hovold , Oliver Neukum , keithp@keithp.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: <99E24BBC-33EF-4B4C-96E6-1FAF4F65C8D8@gmail.com> References: <20EC9664-054E-438B-B411-2145D347F97B@gmail.com> <257eb882-44dc-4e25-82f9-9cf9b455936d@rowland.harvard.edu> <2a50158f-34ff-41ae-8899-ba2ec6d550b3@suse.com> <67613cb1-acaa-4870-93ed-95a282a74f06@rowland.harvard.edu> <0085d585-c3e8-455f-9959-b019800f08ea@rowland.harvard.edu> To: Alan Stern X-Mailer: Apple Mail (2.3864.600.51.1.1) > On Jun 8, 2026, at 12:03, Alan Stern wrote: > > On Mon, Jun 08, 2026 at 05:11:27PM +0200, Johan Hovold wrote: >> 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. > > Yes, you're right of course. And I'm annoyed, because I had realized > exactly the same thing before noticing the usb_get_intf() and > usb_put_intf() calls, and then forgot about it when updating the patch! > > The final version of the patch is below. > > Alan Stern > I tested this patch. It works on my side. Thank you! > > Index: usb-devel/drivers/usb/misc/chaoskey.c > =================================================================== > --- usb-devel.orig/drivers/usb/misc/chaoskey.c > +++ usb-devel/drivers/usb/misc/chaoskey.c > @@ -320,7 +320,6 @@ bail: > mutex_unlock(&dev->lock); > destruction: > mutex_unlock(&chaoskey_list_lock); > - usb_dbg(interface, "release success"); > return rv; > }