From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: Vladis Dronov <vdronov@redhat.com>,
Johan Hovold <johan@kernel.org>, stable <stable@vger.kernel.org>
Subject: Re: [PATCH] USB: visor: fix null-deref at probe
Date: Tue, 12 Jan 2016 12:08:50 +0100 [thread overview]
Message-ID: <20160112110850.GP10100@localhost> (raw)
In-Reply-To: <1452596720-29839-1-git-send-email-johan@kernel.org>
On Tue, Jan 12, 2016 at 12:05:20PM +0100, Johan Hovold wrote:
> Fix null-pointer dereference at probe should a (malicious) Treo device
> lack the expected endpoints.
>
> Specifically, the Treo port-setup hack was dereferencing the bulk-in and
> interrupt-in urbs without first making sure they had been allocated by
> core.
>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
Vladis,
turns out the Treo devices had a similar problem.
You should be able to just use just
if (serial->num_bulk_out < 2)
return -ENODEV;
for your case.
> drivers/usb/serial/visor.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
> index 60afb39eb73c..c53fbb3e0b8c 100644
> --- a/drivers/usb/serial/visor.c
> +++ b/drivers/usb/serial/visor.c
> @@ -544,6 +544,11 @@ static int treo_attach(struct usb_serial *serial)
> (serial->num_interrupt_in == 0))
> return 0;
>
> + if (serial->num_bulk_in < 2 || serial->num_interrupt_in < 2) {
> + dev_err(&serial->interface->dev, "missing endpoints\n");
> + return -ENODEV;
> + }
> +
> /*
> * It appears that Treos and Kyoceras want to use the
> * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
Thanks,
Johan
next prev parent reply other threads:[~2016-01-12 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 11:05 [PATCH] USB: visor: fix null-deref at probe Johan Hovold
2016-01-12 11:08 ` Johan Hovold [this message]
2016-01-25 10:05 ` Johan Hovold
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=20160112110850.GP10100@localhost \
--to=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vdronov@redhat.com \
/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).