can: ucan: fix devres lifetime
Subsystems (2)
PATCH 1/1 can: ucan: fix devres lifetime
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 9f2d3eae88d2 ("can: ucan: add driver for Theobroma Systems UCAN devices")
Cc [email protected] # 4.19
Cc Jakob Unterwurzacher <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
--- drivers/net/can/usb/ucan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/ucan.c +1 -1
@@ -1397,7 +1397,7 @@ static int ucan_probe(struct usb_interface *intf,*/ /* Prepare Memory for control transfers */ - ctl_msg_buffer =devm_kzalloc (&udev->dev, + ctl_msg_buffer =devm_kzalloc (&intf->dev,sizeof (union ucan_ctl_payload ),GFP_KERNEL );if (!ctl_msg_buffer) {
Signature · 1 line
2.52.0