* [PATCH v2] wifi: rt2x00usb: fix devres lifetime
@ 2026-03-27 11:32 Johan Hovold
2026-03-27 12:19 ` Stanislaw Gruszka
2026-03-27 12:45 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2026-03-27 11:32 UTC (permalink / raw)
To: Stanislaw Gruszka
Cc: linux-wireless, linux-kernel, Johan Hovold, stable, Vishal Thanki
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 USB anchor lifetime so that it is released on driver unbind.
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Cc: stable@vger.kernel.org # 4.7
Cc: Vishal Thanki <vishalthanki@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index 83d00b6baf64..174d89b0b1d7 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -826,7 +826,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
if (retval)
goto exit_free_device;
- rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
+ rt2x00dev->anchor = devm_kmalloc(&usb_intf->dev,
sizeof(struct usb_anchor),
GFP_KERNEL);
if (!rt2x00dev->anchor) {
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: rt2x00usb: fix devres lifetime
2026-03-27 11:32 [PATCH v2] wifi: rt2x00usb: fix devres lifetime Johan Hovold
@ 2026-03-27 12:19 ` Stanislaw Gruszka
2026-03-27 12:45 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2026-03-27 12:19 UTC (permalink / raw)
To: Johan Hovold; +Cc: linux-wireless, linux-kernel, stable, Vishal Thanki
On Fri, Mar 27, 2026 at 12:32:19PM +0100, Johan Hovold wrote:
> 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 USB anchor lifetime so that it is released on driver unbind.
>
> Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
> Cc: stable@vger.kernel.org # 4.7
> Cc: Vishal Thanki <vishalthanki@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
> drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> index 83d00b6baf64..174d89b0b1d7 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> @@ -826,7 +826,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
> if (retval)
> goto exit_free_device;
>
> - rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
> + rt2x00dev->anchor = devm_kmalloc(&usb_intf->dev,
> sizeof(struct usb_anchor),
> GFP_KERNEL);
> if (!rt2x00dev->anchor) {
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: rt2x00usb: fix devres lifetime
2026-03-27 11:32 [PATCH v2] wifi: rt2x00usb: fix devres lifetime Johan Hovold
2026-03-27 12:19 ` Stanislaw Gruszka
@ 2026-03-27 12:45 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-03-27 12:45 UTC (permalink / raw)
To: Johan Hovold
Cc: Stanislaw Gruszka, linux-wireless, linux-kernel, stable,
Vishal Thanki
On Fri, Mar 27, 2026 at 12:32:19PM +0100, Johan Hovold wrote:
> 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 USB anchor lifetime so that it is released on driver unbind.
>
> Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
> Cc: stable@vger.kernel.org # 4.7
> Cc: Vishal Thanki <vishalthanki@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> index 83d00b6baf64..174d89b0b1d7 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> @@ -826,7 +826,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
> if (retval)
> goto exit_free_device;
>
> - rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
> + rt2x00dev->anchor = devm_kmalloc(&usb_intf->dev,
> sizeof(struct usb_anchor),
> GFP_KERNEL);
> if (!rt2x00dev->anchor) {
> --
> 2.52.0
>
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-27 12:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 11:32 [PATCH v2] wifi: rt2x00usb: fix devres lifetime Johan Hovold
2026-03-27 12:19 ` Stanislaw Gruszka
2026-03-27 12:45 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox