linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: kvaser_usb: check number of channels returned by HW
@ 2014-02-11 10:01 Olivier Sobrie
  2014-02-11 10:09 ` Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Olivier Sobrie @ 2014-02-11 10:01 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Olivier Sobrie

It is needed to check the number of channels returned by the HW
because it cannot be greater than MAX_NET_DEVICES otherwise
it will crash.

Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
---
 drivers/net/can/usb/kvaser_usb.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 4b2d5ed..cc3df8a 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -474,6 +474,8 @@ static int kvaser_usb_get_card_info(struct kvaser_usb *dev)
 		return err;
 
 	dev->nchannels = msg.u.cardinfo.nchannels;
+	if (dev->nchannels > MAX_NET_DEVICES)
+		return -EINVAL;
 
 	return 0;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* pull-request: can 2014-02-12
@ 2014-02-12 10:35 Marc Kleine-Budde
  2014-02-12 10:35 ` [PATCH] can: kvaser_usb: check number of channels returned by HW Marc Kleine-Budde
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-12 10:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request with one patch for net/master, for the current release
cycle. Olivier Sobrie noticed and fixed that the kvaser_usb driver doesn't
check the number of channels value from the hardware, which may result in
writing over the bounds of an array in the driver.

regards,
Marc

---

The following changes since commit 738b52bb9845da183b6ff46a8f685b56a63379d1:

  Merge tag 'microblaze-3.14-rc3' of git://git.monstr.eu/linux-2.6-microblaze (2014-02-11 12:24:35 -0800)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can.git tags/linux-can-fixes-for-3.14-20140212

for you to fetch changes up to 862474f8b46f6c1e600d4934e40ba40646c696ec:

  can: kvaser_usb: check number of channels returned by HW (2014-02-12 10:42:02 +0100)

----------------------------------------------------------------
linux-can-fixes-for-3.14-20140212

----------------------------------------------------------------
Olivier Sobrie (1):
      can: kvaser_usb: check number of channels returned by HW

 drivers/net/can/usb/kvaser_usb.c | 2 ++
 1 file changed, 2 insertions(+)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-12 10:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 10:01 [PATCH] can: kvaser_usb: check number of channels returned by HW Olivier Sobrie
2014-02-11 10:09 ` Marc Kleine-Budde
2014-02-11 12:33   ` Olivier Sobrie
2014-02-11 12:36     ` Marc Kleine-Budde
  -- strict thread matches above, loose matches on Subject: below --
2014-02-12 10:35 pull-request: can 2014-02-12 Marc Kleine-Budde
2014-02-12 10:35 ` [PATCH] can: kvaser_usb: check number of channels returned by HW Marc Kleine-Budde

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).