mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Johan Hovold <johan@kernel.org>, Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe
Date: Mon, 13 Mar 2017 06:42:45 -0700	[thread overview]
Message-ID: <a0515a2d-d219-d32d-b906-564bb789ce09@roeck-us.net> (raw)
In-Reply-To: <20170313124945.28923-1-johan@kernel.org>

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 ?

Thanks,
Guenter

> 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;
>
>

  reply	other threads:[~2017-03-13 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 12:49 Johan Hovold
2017-03-13 13:42 ` Guenter Roeck [this message]
2017-03-13 14:17   ` Johan Hovold
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=a0515a2d-d219-d32d-b906-564bb789ce09@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®