Skip to content

Commit 50d34a0

Browse files
can: gs_usb: gs_make_candev(): fix memory leak for devices with extended bit timing configuration
Some CAN-FD capable devices offer extended bit timing information for the data bit timing. The information must be read with an USB control message. The memory for this message is allocated but not free()ed (in the non error case). This patch adds the missing free. Fixes: 6679f4c ("can: gs_usb: add extended bt_const feature") Link: https://lore.kernel.org/all/20220329193450.659726-1-mkl@pengutronix.de Reported-by: syzbot+4d0ae90a195b269f102d@syzkaller.appspotmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 136bed0 commit 50d34a0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/can/usb/gs_usb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,8 @@ static struct gs_can *gs_make_candev(unsigned int channel,
10921092
dev->data_bt_const.brp_inc = le32_to_cpu(bt_const_extended->dbrp_inc);
10931093

10941094
dev->can.data_bittiming_const = &dev->data_bt_const;
1095+
1096+
kfree(bt_const_extended);
10951097
}
10961098

10971099
SET_NETDEV_DEV(netdev, &intf->dev);

0 commit comments

Comments
 (0)