From: Greg KH <gregkh@linuxfoundation.org>
To: Johan Hovold <johan@kernel.org>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Vishal Thanki <vishalthanki@gmail.com>
Subject: Re: [PATCH v2] wifi: rt2x00usb: fix devres lifetime
Date: Fri, 27 Mar 2026 13:45:10 +0100 [thread overview]
Message-ID: <2026032700-footless-basil-7bac@gregkh> (raw)
In-Reply-To: <20260327113219.1313748-1-johan@kernel.org>
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>
prev parent reply other threads:[~2026-03-27 12:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026032700-footless-basil-7bac@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stf_xl@wp.pl \
--cc=vishalthanki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox