projects
/
kernel
/
kernel-generic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
738b52b
)
can: kvaser_usb: check number of channels returned by HW
author
Olivier Sobrie
<olivier@sobrie.be>
Tue, 11 Feb 2014 10:01:23 +0000
(11:01 +0100)
committer
Marc Kleine-Budde
<mkl@pengutronix.de>
Wed, 12 Feb 2014 09:42:02 +0000
(10:42 +0100)
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>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/kvaser_usb.c
patch
|
blob
|
history
diff --git
a/drivers/net/can/usb/kvaser_usb.c
b/drivers/net/can/usb/kvaser_usb.c
index
6c859bb
..
e77d110
100644
(file)
--- a/
drivers/net/can/usb/kvaser_usb.c
+++ b/
drivers/net/can/usb/kvaser_usb.c
@@
-473,6
+473,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;
}