diff mbox

[3.8.y.z,extended,stable] Patch "can: kvaser_usb: check number of channels returned by HW" has been added to staging queue

Message ID 1395330876-5156-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa March 20, 2014, 3:54 p.m. UTC
This is a note to let you know that I have just added a patch titled

    can: kvaser_usb: check number of channels returned by HW

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue

This patch is scheduled to be released in version 3.8.13.20.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

From f16af0c304b8da32873517dcd7880dc4bc7518ae Mon Sep 17 00:00:00 2001
From: Olivier Sobrie <olivier@sobrie.be>
Date: Tue, 11 Feb 2014 11:01:23 +0100
Subject: can: kvaser_usb: check number of channels returned by HW

commit 862474f8b46f6c1e600d4934e40ba40646c696ec upstream.

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>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/can/usb/kvaser_usb.c | 2 ++
 1 file changed, 2 insertions(+)

--
1.8.3.2
diff mbox

Patch

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 431f07e..c303dbf 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;
 }