From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82D1537B018 for ; Sat, 9 May 2026 03:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778296113; cv=none; b=Z1+X9Myq40ivJ83Z2xvi+VLpeaMQV63TWR2jta96Zv09vwWefaNBsrRvypI0fOnebHLeqaQMIEQR9STR3hvq/+zRC3ez5XaVswGAerHiiFH8VXCcYINhzcF7gmmMx1azA+L0O8Cws9CAfq67GYCe59HzaCNcoCmd5Xo9ni7ADp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778296113; c=relaxed/simple; bh=GGEsXBE86l7xHgNFaIZg+xgHc8srKdu4nTXzSJ2Dbe0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dsqKxT3FZDf/6vKXxzlHYE8reeJlRW0ZVyfMumqqXLginif3Wxdo+x42aaGEgKbvNBNBE01Z1I7r3cj7FoBKV9zcjCMUhruARbosw5DGmvOTxyLDU5EX12zCEx1pvpU+kA+ZWAwGE2LWDHPKCxSJRgvOYP60lHWCQGEpCwgj3Jo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lxbpui28; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lxbpui28" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1417C2BCB8; Sat, 9 May 2026 03:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778296113; bh=GGEsXBE86l7xHgNFaIZg+xgHc8srKdu4nTXzSJ2Dbe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lxbpui28gwJ9NgpAA5IraVMd2vJk005W8L9V+hNhh/t4VbYjLR22zXpletIWn44sE wY7HCRlTuUHkXCjcsddk3doH4e6Jqm9t00shKeg3jaMzhUh/CWfMzJSDAR1W2YZlMM MOi2BpQNMfZdguxClWt7tBAYgcfoqI62OX6+2+WAfFOp50ycLrkhk27MFUOhVF0YSM di/aa3PU4fMbN2+E0i0z+36G6gO1Fpu5tnjT07TCkqkIiu3tcKlo/jBuTdf/S65PvL l+TbZSHsOATe9hpv9KDiGgIe8HBmqPMi9BiTdpu6cvyLJcCC+tPqHikXIy1XkmdeZP gi8hEIaxqBmIg== From: Sasha Levin To: stable@vger.kernel.org Cc: Johan Hovold , Jakob Unterwurzacher , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10.y 2/2] can: ucan: fix devres lifetime Date: Fri, 8 May 2026 23:08:29 -0400 Message-ID: <20260509030829.3038691-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260509030829.3038691-1-sashal@kernel.org> References: <2026050411-squeegee-passion-d179@gregkh> <20260509030829.3038691-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johan Hovold [ Upstream commit fed4626501c871890da287bec62a96e52da1af89 ] 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: stable@vger.kernel.org # 4.19 Cc: Jakob Unterwurzacher Signed-off-by: Johan Hovold Link: https://patch.msgid.link/20260327104520.1310158-1-johan@kernel.org Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/usb/ucan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c index 58069c96cab20..64dcbeef7a7c2 100644 --- a/drivers/net/can/usb/ucan.c +++ b/drivers/net/can/usb/ucan.c @@ -1394,7 +1394,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) { -- 2.53.0