From: Johan Hovold <johan@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Johan Hovold <johan@kernel.org>, Wim Van Sebroeck <wim@iguana.be>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
stable <stable@vger.kernel.org>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe
Date: Mon, 13 Mar 2017 15:17:39 +0100 [thread overview]
Message-ID: <20170313141739.GS4211@localhost> (raw)
In-Reply-To: <a0515a2d-d219-d32d-b906-564bb789ce09@roeck-us.net>
[ Adding linux-usb which I forgot to CC for this one ]
On Mon, Mar 13, 2017 at 06:42:45AM -0700, Guenter Roeck wrote:
> On 03/13/2017 05:49 AM, Johan Hovold wrote:
> > Make sure to check the number of endpoints to avoid dereferencing a
> > NULL-pointer should a malicious device lack endpoints.
> >
>
> Is this theory or was it actually observed ?
This was found through inspection, but creating a USB device to crash a
host with this driver enabled is easily done.
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Cc: stable <stable@vger.kernel.org>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> > drivers/watchdog/pcwd_usb.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
> > index 99ebf6ea3de6..5615f4013924 100644
> > --- a/drivers/watchdog/pcwd_usb.c
> > +++ b/drivers/watchdog/pcwd_usb.c
> > @@ -630,6 +630,9 @@ static int usb_pcwd_probe(struct usb_interface *interface,
> > return -ENODEV;
> > }
> >
> > + if (iface_desc->desc.bNumEndpoints < 1)
> > + return -ENODEV;
> > +
> > /* check out the endpoint: it has to be Interrupt & IN */
> > endpoint = &iface_desc->endpoint[0].desc;
> >
> >
Johan
next prev parent reply other threads:[~2017-03-13 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 12:49 [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe Johan Hovold
2017-03-13 13:42 ` Guenter Roeck
2017-03-13 14:17 ` Johan Hovold [this message]
2017-03-13 17:15 ` Guenter Roeck
2017-03-13 17:16 ` Guenter Roeck
2017-04-03 8:36 ` Johan Hovold
2017-04-03 14:05 ` Guenter Roeck
2017-05-12 10:36 ` Johan Hovold
2017-05-12 16:59 ` Guenter Roeck
2017-05-14 13:05 ` Wim Van Sebroeck
2017-05-14 13:20 ` Wim Van Sebroeck
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=20170313141739.GS4211@localhost \
--to=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=stable@vger.kernel.org \
--cc=wim@iguana.be \
/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).