* [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
* Re: [PATCH] can: kvaser_usb: check number of channels returned by HW
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
0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-11 10:09 UTC (permalink / raw)
To: Olivier Sobrie; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
On 02/11/2014 11:01 AM, Olivier Sobrie wrote:
> 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>
Does this bug occur on any kvaser USB hardware?
However, I think, I'll add stable on Cc
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: kvaser_usb: check number of channels returned by HW
2014-02-11 10:09 ` Marc Kleine-Budde
@ 2014-02-11 12:33 ` Olivier Sobrie
2014-02-11 12:36 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: Olivier Sobrie @ 2014-02-11 12:33 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
Hello Marc,
On Tue, Feb 11, 2014 at 11:09:57AM +0100, Marc Kleine-Budde wrote:
> On 02/11/2014 11:01 AM, Olivier Sobrie wrote:
> > 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>
>
> Does this bug occur on any kvaser USB hardware?
I never see it with the devices I have and nobody reported me a problem
regarding this. I found this bug by chance while I was looking to add
support for Kvaser device from usbcanII family.
> However, I think, I'll add stable on Cc
Good idea :-)
Thank you,
--
Olivier
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: kvaser_usb: check number of channels returned by HW
2014-02-11 12:33 ` Olivier Sobrie
@ 2014-02-11 12:36 ` Marc Kleine-Budde
0 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-11 12:36 UTC (permalink / raw)
To: Olivier Sobrie; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
On 02/11/2014 01:33 PM, Olivier Sobrie wrote:
> Hello Marc,
>
> On Tue, Feb 11, 2014 at 11:09:57AM +0100, Marc Kleine-Budde wrote:
>> On 02/11/2014 11:01 AM, Olivier Sobrie wrote:
>>> 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>
>>
>> Does this bug occur on any kvaser USB hardware?
>
> I never see it with the devices I have and nobody reported me a problem
> regarding this. I found this bug by chance while I was looking to add
> support for Kvaser device from usbcanII family.
Tnx, I'll include the patch in my next pull request to David.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply [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* [PATCH] can: kvaser_usb: check number of channels returned by HW
2014-02-12 10:35 pull-request: can 2014-02-12 Marc Kleine-Budde
@ 2014-02-12 10:35 ` Marc Kleine-Budde
0 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2014-02-12 10:35 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Olivier Sobrie, linux-stable,
Marc Kleine-Budde
From: Olivier Sobrie <olivier@sobrie.be>
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 | 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 6c859bb..e77d110 100644
--- 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;
}
--
1.8.5.3
^ permalink raw reply related [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).