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>
Cc: Wim Van Sebroeck <wim@iguana.be>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe
Date: Mon, 13 Mar 2017 10:16:33 -0700	[thread overview]
Message-ID: <20170313171633.GB16813@roeck-us.net> (raw)
In-Reply-To: <20170313124945.28923-1-johan@kernel.org>

On Mon, Mar 13, 2017 at 01:49:45PM +0100, Johan Hovold wrote:
> Make sure to check the number of endpoints to avoid dereferencing a
> NULL-pointer should a malicious device lack endpoints.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Note that I dropped Cc: stable from my reply since it is not appropriate
at this time.

Guenter

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

  parent reply	other threads:[~2017-03-13 17:16 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
2017-03-13 14:17   ` Johan Hovold
2017-03-13 17:15     ` Guenter Roeck
2017-03-13 17:16 ` Guenter Roeck [this message]
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=20170313171633.GB16813@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=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®