From: Stéphane Grosjean pcan_usb_get_can_channel_id() takes the CAN channel ID of a PCAN-USB from the args[] array, which pcan_usb_wait_rsp() fills with the response of the device. However, args[] is not initialized, and pcan_usb_wait_rsp() returns success without touching it once the device is no longer connected. peak_usb_disconnect() clears PCAN_USB_STATE_CONNECTED before it unregisters the netdevs. An ETHTOOL_GEEPROM request handled in this window makes peak_usb_get_eeprom() copy an uninitialized stack byte to userspace, and cache it in dev->can_channel_id. Initialize args[], so that a null ID is returned in that case. Found by Sashiko AI review. Fixes: 36d007c6fc79 ("can: peak_usb: add ethtool interface to user-configurable CAN channel identifier") Cc: stable@vger.kernel.org Signed-off-by: Stéphane Grosjean Link: https://patch.msgid.link/20261126-canfd_check_channel_idx-v9-11-abe0099b4585@peak-system.fr Signed-off-by: Marc Kleine-Budde --- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 6d423b38e9c1..fccec53b8440 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c @@ -386,7 +386,7 @@ static int pcan_usb_get_serial(struct peak_usb_device *dev, u32 *serial_number) */ static int pcan_usb_get_can_channel_id(struct peak_usb_device *dev, u32 *can_ch_id) { - u8 args[PCAN_USB_CMD_ARGS_LEN]; + u8 args[PCAN_USB_CMD_ARGS_LEN] = {}; int err; err = pcan_usb_wait_rsp(dev, PCAN_USB_CMD_DEVID, PCAN_USB_GET, args); -- 2.53.0