Linux CAN drivers development
 help / color / mirror / Atom feed
From: "Max S." <max@schneidersoft.net>
To: Matthias Fuchs <matthias.fuchs@esd.eu>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH] net: can: esd_usb2: check index of array before accessing
Date: Wed, 03 Jul 2013 11:51:39 +0000	[thread overview]
Message-ID: <1372852299.15632.13.camel@blackbox> (raw)
In-Reply-To: <51D3F638.3080207@esd.eu>

On Wed, 2013-07-03 at 12:00 +0200, Matthias Fuchs wrote:
> Hi,
> 
> did anybody encounter an issue with invalid net codes comming from the
> device?
Technically one could write a usb device that sends a bad
netcode/crafted message.

through 
esd_usb2_read_bulk_callback()
	esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg);
	...
	esd_usb2_rx_event()
		...
		u8 state = msg->msg.rx.data[0];
		...
		priv->old_state = state;

one could write any u8 memory value to <255 past dev->nets.

... I think.

> 
> Well, you may add my
> 
> Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu>
> 
> Matthias
> 
> On 03.07.2013 10:33, Marc Kleine-Budde wrote:
> > From: Maximilian Schneider <max@schneidersoft.net>
> > 
> > The esd_usb2_read_bulk_callback() function is parsing the data that comes from
> > the USB CAN adapter. One datum is used as an index to access the dev->nets[]
> > array. This patch adds the missing bounds checking.
> > 
> > Cc: Matthias Fuchs <matthias.fuchs@esd.eu>
> > Signed-off-by: Maximilian Schneider <max@schneidersoft.net>
:D
> > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > ---
> > Hello,
> > 
> > Maximilian, I've added a more detailed patch description and the error message
> > printing. What do you think. 
Looks good.

regards,
Max Schneider



  parent reply	other threads:[~2013-07-03 11:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  8:33 [PATCH] net: can: esd_usb2: check index of array before accessing Marc Kleine-Budde
2013-07-03 10:00 ` Matthias Fuchs
2013-07-03 10:04   ` Marc Kleine-Budde
2013-07-03 11:51   ` Max S. [this message]
2013-07-03 11:51     ` Marc Kleine-Budde
     [not found]     ` <51D41E53.2030900@esd.eu>
2013-07-03 13:04       ` Marc Kleine-Budde

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=1372852299.15632.13.camel@blackbox \
    --to=max@schneidersoft.net \
    --cc=linux-can@vger.kernel.org \
    --cc=matthias.fuchs@esd.eu \
    --cc=mkl@pengutronix.de \
    /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