From: Greg KH <greg@kroah.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: andreyknvl@google.com, gustavo@embeddedor.com,
Kernel development list <linux-kernel@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>,
suwan.kim027@gmail.com, syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] USB: Fix slab-out-of-bounds write in usb_get_bos_descriptor
Date: Mon, 13 May 2019 22:48:51 +0200 [thread overview]
Message-ID: <20190513204851.GA20475@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1905131313100.1478-100000@iolanthe.rowland.org>
On Mon, May 13, 2019 at 01:14:29PM -0400, Alan Stern wrote:
> The syzkaller USB fuzzer found a slab-out-of-bounds write bug in the
> USB core, caused by a failure to check the actual size of a BOS
> descriptor. This patch adds a check to make sure the descriptor is at
> least as large as it is supposed to be, so that the code doesn't
> inadvertently access memory beyond the end of the allocated region
> when assigning to dev->bos->desc->bNumDeviceCaps later on.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Reported-and-tested-by: syzbot+71f1e64501a309fcc012@syzkaller.appspotmail.com
> CC: <stable@vger.kernel.org>
>
> ---
>
>
> [as1898]
>
>
> drivers/usb/core/config.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: usb-devel/drivers/usb/core/config.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/core/config.c
> +++ usb-devel/drivers/usb/core/config.c
> @@ -932,8 +932,8 @@ int usb_get_bos_descriptor(struct usb_de
>
> /* Get BOS descriptor */
> ret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);
> - if (ret < USB_DT_BOS_SIZE) {
> - dev_err(ddev, "unable to get BOS descriptor\n");
> + if (ret < USB_DT_BOS_SIZE || bos->bLength < USB_DT_BOS_SIZE) {
> + dev_err(ddev, "unable to get BOS descriptor or descriptor too short\n");
Nice fix, I thought we had found all of these the last time we fuzzed
this area :)
I'll queue this up once 5.2-rc1 is out, thanks.
greg k-h
prev parent reply other threads:[~2019-05-13 20:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 19:57 KASAN: slab-out-of-bounds Write in usb_get_bos_descriptor syzbot
2019-05-13 14:47 ` Alan Stern
2019-05-13 15:29 ` syzbot
2019-05-13 17:14 ` [PATCH] USB: Fix slab-out-of-bounds write " Alan Stern
2019-05-13 20:48 ` Greg KH [this message]
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=20190513204851.GA20475@kroah.com \
--to=greg@kroah.com \
--cc=andreyknvl@google.com \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=suwan.kim027@gmail.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