Skip to content

Commit 4b7d077

Browse files
jhovoldgregkh
authored andcommitted
can: ucan: fix devres lifetime
commit fed4626 upstream. USB drivers bind to USB interfaces and any device managed resources should have their lifetime tied to the interface rather than parent USB device. This avoids issues like memory leaks when drivers are unbound without their devices being physically disconnected (e.g. on probe deferral or configuration changes). Fix the control message buffer lifetime so that it is released on driver unbind. Fixes: 9f2d3ea ("can: ucan: add driver for Theobroma Systems UCAN devices") Cc: stable@vger.kernel.org # 4.19 Cc: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260327104520.1310158-1-johan@kernel.org Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 204028a commit 4b7d077

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/can/usb/ucan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static int ucan_probe(struct usb_interface *intf,
13991399
*/
14001400

14011401
/* Prepare Memory for control transfers */
1402-
ctl_msg_buffer = devm_kzalloc(&udev->dev,
1402+
ctl_msg_buffer = devm_kzalloc(&intf->dev,
14031403
sizeof(union ucan_ctl_payload),
14041404
GFP_KERNEL);
14051405
if (!ctl_msg_buffer) {

0 commit comments

Comments
 (0)