From: Alan Stern <stern@rowland.harvard.edu>
To: syzbot <syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com>
Cc: andreyknvl@google.com, <chunkeey@gmail.com>,
<chunkeey@googlemail.com>, <davem@davemloft.net>,
<kvalo@codeaurora.org>,
Kernel development list <linux-kernel@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>,
<linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org>,
Oliver Neukum <oneukum@suse.com>,
<syzkaller-bugs@googlegroups.com>
Subject: Re: KASAN: use-after-free Read in p54u_load_firmware_cb
Date: Sat, 18 May 2019 11:13:39 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1905181045400.7855-100000@netrider.rowland.org> (raw)
In-Reply-To: <00000000000009fcff05891bae0a@google.com>
On Fri, 17 May 2019, syzbot wrote:
> Hello,
>
> syzbot tried to test the proposed patch but build/boot failed:
Drat. Mistake in the patch. Let's try again.
Incidentally, as far as I can tell there's no point in having the
usb_get_dev() in p54u_probe() and usb_put_dev() in p54u_disconnect().
The device structure is guaranteed not to be deallocated while a driver
is bound to any of its interfaces, so taking an extra reference won't
make any difference.
On the other hand, I do see some problems in the firmware-load
callback. First, it calls device_release_driver() without first
checking that the interface is still bound to the p54u driver.
Second, it shouldn't call device_release_driver() at all -- it should
call usb_driver_release_interface(). It doesn't want to unbind the USB
device's driver; it wants to unbind the interface's driver. And third,
to do this it needs to acquire udev's device lock, not the lock for
udev's parent.
Alan Stern
#syz test: https://github.com/google/kasan.git usb-fuzzer
drivers/net/wireless/intersil/p54/p54usb.c | 3 +++
1 file changed, 3 insertions(+)
Index: usb-devel/drivers/net/wireless/intersil/p54/p54usb.c
===================================================================
--- usb-devel.orig/drivers/net/wireless/intersil/p54/p54usb.c
+++ usb-devel/drivers/net/wireless/intersil/p54/p54usb.c
@@ -923,6 +923,7 @@ static void p54u_load_firmware_cb(const
struct usb_device *udev = priv->udev;
int err;
+ pr_info("%s: priv->udev = %px\n", __func__, udev);
complete(&priv->fw_wait_load);
if (firmware) {
priv->fw = firmware;
@@ -969,6 +970,8 @@ static int p54u_load_firmware(struct iee
if (i < 0)
return i;
+ dev_info(&udev->dev, "%s: udev @ %px, dev.parent @ %px\n",
+ __func__, udev, &udev->dev.parent);
dev_info(&priv->udev->dev, "Loading firmware file %s\n",
p54u_fwlist[i].fw);
next prev parent reply other threads:[~2019-05-18 15:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-06 11:16 KASAN: use-after-free Read in p54u_load_firmware_cb syzbot
2019-05-13 10:23 ` syzbot
2019-05-13 13:28 ` Oliver Neukum
2019-05-17 19:21 ` Christian Lamparter
2019-05-17 20:46 ` Alan Stern
2019-05-17 21:01 ` syzbot
2019-05-18 15:13 ` Alan Stern [this message]
2019-05-18 15:50 ` syzbot
2019-05-18 16:32 ` Alan Stern
2019-05-18 16:50 ` syzbot
2019-05-18 17:01 ` Alan Stern
2019-05-18 17:36 ` syzbot
2019-05-18 17:49 ` Alan Stern
2019-05-18 18:31 ` syzbot
2019-05-18 20:11 ` Christian Lamparter
2019-05-20 14:44 ` [PATCH] network: wireless: p54u: Fix race between disconnect and firmware loading Alan Stern
2019-05-24 21:19 ` Christian Lamparter
2019-05-28 12:11 ` Kalle Valo
2019-05-28 14:17 ` Alan Stern
2019-05-28 14:29 ` Kalle Valo
2019-06-25 4:43 ` [PATCH] p54usb: " Kalle Valo
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=Pine.LNX.4.44L0.1905181045400.7855-100000@netrider.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=andreyknvl@google.com \
--cc=chunkeey@gmail.com \
--cc=chunkeey@googlemail.com \
--cc=davem@davemloft.net \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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;
as well as URLs for NNTP newsgroup(s).