linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] ims-pcu: sanity check against missing interfaces
Date: Thu, 17 Mar 2016 14:01:55 -0700	[thread overview]
Message-ID: <20160317210155.GA21461@dtor-ws> (raw)
In-Reply-To: <1458223847-9878-1-git-send-email-oneukum@suse.com>

On Thu, Mar 17, 2016 at 03:10:47PM +0100, Oliver Neukum wrote:
> A malicious device missing interface can make the driver oops.
> Add sanity checking.
> 
> Signed-off-by: Oliver Neukum <ONeukum@suse.com>
> CC: stable@vger.kernel.org

Applied, thank you.

> ---
>  drivers/input/misc/ims-pcu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
> index ac1fa5f..9c0ea36 100644
> --- a/drivers/input/misc/ims-pcu.c
> +++ b/drivers/input/misc/ims-pcu.c
> @@ -1663,6 +1663,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
>  
>  	pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
>  					 union_desc->bMasterInterface0);
> +	if (!pcu->ctrl_intf)
> +		return -EINVAL;
>  
>  	alt = pcu->ctrl_intf->cur_altsetting;
>  	pcu->ep_ctrl = &alt->endpoint[0].desc;
> @@ -1670,6 +1672,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
>  
>  	pcu->data_intf = usb_ifnum_to_if(pcu->udev,
>  					 union_desc->bSlaveInterface0);
> +	if (!pcu->data_intf)
> +		return -EINVAL;
>  
>  	alt = pcu->data_intf->cur_altsetting;
>  	if (alt->desc.bNumEndpoints != 2) {
> -- 
> 2.1.4
> 

-- 
Dmitry

      reply	other threads:[~2016-03-17 21:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 14:10 [PATCH] ims-pcu: sanity check against missing interfaces Oliver Neukum
2016-03-17 21:01 ` Dmitry Torokhov [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=20160317210155.GA21461@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stable@vger.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).