mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 03:11:11 -04:00
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: 9f2d3eae88 ("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>
This commit is contained in:
committed by
Marc Kleine-Budde
parent
ebe560ea5f
commit
fed4626501
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user