From: Johan Hovold <johan@kernel.org>
To: Young Xiao <92siuyang@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, greg@kroah.com, mchehab@kernel.org,
keescook@chromium.org, hans.verkuil@cisco.com,
Young Xiao <YangX92@hotmail.com>
Subject: Re: [PATCH] USB: s2255 & stkwebcam: fix oops with malicious USB descriptors
Date: Tue, 16 Apr 2019 13:33:43 +0200 [thread overview]
Message-ID: <20190416113343.GJ775@localhost> (raw)
In-Reply-To: <20190416112645.GI775@localhost>
On Tue, Apr 16, 2019 at 01:26:45PM +0200, Johan Hovold wrote:
> On Thu, Apr 11, 2019 at 12:54:12PM +0800, Young Xiao wrote:
> > From: Young Xiao <YangX92@hotmail.com>
> >
> > The driver expects at least one valid endpoint. If given
> > malicious descriptors that specify 0 for the number of endpoints,
> > it will crash in the probe function. Ensure there is at least
> > one endpoint on the interface before using it.
>
> Why do claim it will crash?
Ok, I see now that Björn already pointed this out to you in your
updated version of this patch.
> > This vulnerability is same as CVE-2016-2188.
>
> Note that the "fix" for this CVE that you're now copying was incomplete.
> Here's the proper fix:
>
> b7321e81fc36 ("USB: iowarrior: fix NULL-deref at probe")
>
> > Signed-off-by: Young Xiao <YangX92@hotmail.com>
> > ---
> > drivers/media/usb/s2255/s2255drv.c | 7 +++++++
> > drivers/media/usb/stkwebcam/stk-webcam.c | 6 ++++++
> > 2 files changed, 13 insertions(+)
> >
> > diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
> > index 5b3e54b..7fdf159 100644
> > --- a/drivers/media/usb/s2255/s2255drv.c
> > +++ b/drivers/media/usb/s2255/s2255drv.c
> > @@ -2263,6 +2263,13 @@ static int s2255_probe(struct usb_interface *interface,
> > iface_desc = interface->cur_altsetting;
> > dev_dbg(&interface->dev, "num EP: %d\n",
> > iface_desc->desc.bNumEndpoints);
> > +
> > + if (iface_desc->desc.bNumEndpoints < 1) {
> > + dev_err(&interface->dev, "Invalid number of endpoints\n");
> > + retval = -EINVAL;
> > + goto error;
> > + }
> > +
> > for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
>
> Besides that you didn't even bother compile-testing this, there is no
> bug here to fix to begin with.
>
> If bNumEndpoints is zero this loop will execute and the driver bails out
> just after since dev->read_endpoint is NULL.
That was meant to read "will never execute".
Johan
next prev parent reply other threads:[~2019-04-16 11:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 4:54 [PATCH] USB: s2255 & stkwebcam: fix oops with malicious USB descriptors Young Xiao
2019-04-11 14:36 ` kbuild test robot
[not found] ` <CAKgHYH27TtpbUKJin+WyTRUvqgpTSBRWBTp6YhsUCpVTnKfNPA@mail.gmail.com>
2019-04-16 10:06 ` Greg KH
2019-04-16 11:26 ` Johan Hovold
2019-04-16 11:33 ` Johan Hovold [this message]
2019-04-12 2:39 Young Xiao
2019-04-12 8:04 ` Bjørn Mork
2019-04-12 8:58 ` Yang Xiao
[not found] ` <CAKgHYH05R2CQ1XmS-KCTtL0J49D2kpnkBgyYxdPc47SNpaf8vA@mail.gmail.com>
2019-04-12 9:07 ` Bjørn Mork
2019-04-12 9:36 ` Yang Xiao
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=20190416113343.GJ775@localhost \
--to=johan@kernel.org \
--cc=92siuyang@gmail.com \
--cc=YangX92@hotmail.com \
--cc=greg@kroah.com \
--cc=hans.verkuil@cisco.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@kernel.org \
/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).