* [PATCH net] can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
@ 2026-01-09 1:36 Jerry Wu
2026-01-09 7:50 ` Vincent Mailhol
0 siblings, 1 reply; 3+ messages in thread
From: Jerry Wu @ 2026-01-09 1:36 UTC (permalink / raw)
To: mkl; +Cc: mailhol, extja, eeodqql09, linux-can, linux-kernel, w.7erry
Uninitialized Kernel memory can leak to USB devices.
Fix this by using kzalloc() instead of kmalloc().
Fixes: 7259124eac7d ("can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c")
Signed-off-by: Jerry Wu <w.7erry@foxmail.com>
---
Commit da2311a6385c (can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices)
fixed a similar issue, CVE-2019-19947, in the same file. The other functions
contain similar logic. Would it make sense to fix them in the same way?
Thank you for time reading this. My apologies if I missed anything.
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
index 1167d38344f1..b031e6e42a41 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
@@ -723,7 +723,7 @@ static int kvaser_usb_leaf_send_simple_cmd(const struct kvaser_usb *dev,
struct kvaser_cmd *cmd;
int rc;
- cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
return -ENOMEM;
@@ -1881,7 +1881,7 @@ static int kvaser_usb_leaf_set_bittiming(const struct net_device *netdev,
struct kvaser_cmd *cmd;
int rc;
- cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
return -ENOMEM;
--
2.52.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
2026-01-09 1:36 [PATCH net] can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices Jerry Wu
@ 2026-01-09 7:50 ` Vincent Mailhol
2026-01-09 8:18 ` Marc Kleine-Budde
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Mailhol @ 2026-01-09 7:50 UTC (permalink / raw)
To: Jerry Wu, mkl
Cc: mailhol, extja, eeodqql09, linux-can, linux-kernel, Jimmy Assarsson
+CC: Jimmy
On 09/01/2026 at 02:36, Jerry Wu wrote:
> Uninitialized Kernel memory can leak to USB devices.
Please explain in your description which field(s) is(are) uninitialized
in cmd.
(or attach a report in which you can witness the information leak).
> Fix this by using kzalloc() instead of kmalloc().
>
> Fixes: 7259124eac7d ("can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c")
> Signed-off-by: Jerry Wu <w.7erry@foxmail.com>
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
2026-01-09 7:50 ` Vincent Mailhol
@ 2026-01-09 8:18 ` Marc Kleine-Budde
0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2026-01-09 8:18 UTC (permalink / raw)
To: Vincent Mailhol; +Cc: Jerry Wu, extja, eeodqql09, linux-can, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
On 09.01.2026 08:50:03, Vincent Mailhol wrote:
> +CC: Jimmy
>
> On 09/01/2026 at 02:36, Jerry Wu wrote:
> > Uninitialized Kernel memory can leak to USB devices.
>
> Please explain in your description which field(s) is(are) uninitialized
> in cmd.
Some memory at the end of struct kvaser_cmd is uninitialized, but
usb_bulk_msg() doesn't send the whole struct.
regards,
Marc
P.S.: It may be a coincidence, but Kery Qi's patch [1] had a similar
form. You take the bug class of an existing CVE and search for the same
pattern in other drivers. I like the idea. Please take a little more
time and check whether it really is a bug before sending bug fix
patches. Otherwise please label the patches accordingly.
[1] https://lore.kernel.org/all/20260108082042.1627-1-qikeyu2017@gmail.com/
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-09 8:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-09 1:36 [PATCH net] can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices Jerry Wu
2026-01-09 7:50 ` Vincent Mailhol
2026-01-09 8:18 ` 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
all inboxes | Powered by JetHome®