diff options
author | Olivier Sobrie <olivier@sobrie.be> | 2014-02-11 11:01:23 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-03-05 17:13:48 +0100 |
commit | a2879c1d14a1bd066b2597d778fb9d89d05bdab0 (patch) | |
tree | 47afe1ce9951a2109207e15f9db64f55d84077ca | |
parent | 358b2ae8062c24bce75df14b1c5bce063901e96a (diff) |
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: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | drivers/net/can/usb/kvaser_usb.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 4b2d5ed62b1..cc3df8aebb8 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; } |