Skip to contentSkip to conversation

pcan_usb_fd: zero out the common command buffer

PATCH In review Oliver Neukum 3 participants 3 messages Aug 8, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcan_usb_fd: zero out the common command buffer

Lest we leak kernel memory to a device we better zero out buffers.

---
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +1 -1
index 34761c3a6286..47cc1ff5b88e 100644
@@ -841,7 +841,7 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 			goto err_out;
 
 		/* allocate command buffer once for all for the interface */
-		pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE,
+		pdev->cmd_buffer_addr = kzalloc(PCAN_UFD_CMD_BUFFER_SIZE,
 						GFP_KERNEL);
 		if (!pdev->cmd_buffer_addr)
 			goto err_out_1;
Signature · 1 line
2.16.4
maintainer
#1 lore raw

From: Oliver Neukum <[email protected]>
Date: Thu, 8 Aug 2019 11:28:25 +0200

Quoted 4 lines

Lest we leak kernel memory to a device we better zero out buffers.

Please CC: the CAN subsystem maintainers, as this is clearly listed in the MAINTAINERS file.

Thank you.

Quoted 20 lines
---
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +1 -1
index 34761c3a6286..47cc1ff5b88e 100644
@@ -841,7 +841,7 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 			goto err_out;
 
 		/* allocate command buffer once for all for the interface */
-		pdev->cmd_buffer_addr = kmalloc(PCAN_UFD_CMD_BUFFER_SIZE,
+		pdev->cmd_buffer_addr = kzalloc(PCAN_UFD_CMD_BUFFER_SIZE,
 						GFP_KERNEL);
 		if (!pdev->cmd_buffer_addr)
 			goto err_out_1;
Signature · 1 line
2.16.4
#2 lore raw
Quoted 10 lines · David Miller

From: Oliver Neukum <[email protected]>
Date: Thu, 8 Aug 2019 11:28:25 +0200

Quoted 4 lines

Lest we leak kernel memory to a device we better zero out buffers.

Please CC: the CAN subsystem maintainers, as this is clearly listed in the MAINTAINERS file.

The issue is already fixed and already mainline ([email protected] is on Cc):

30a8beeb3042 can: peak_usb: pcan_usb_fd: Fix info-leaks to USB devices

Marc

Signature · 4 lines
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   |