mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Sascha Hauer <s.hauer@pengutronix.de>, linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Ping-Ke Shih" <pkshih@realtek.com>,
	"Kalle Valo" <kvalo@kernel.org>,
	"Ilgaz Öcal" <ilgaz@ilgaz.gen.tr>,
	kernel@pengutronix.de
Subject: Re: [PATCH] wifi: rtw88: usb: kill and free rx urbs on probe failure
Date: Wed, 23 Aug 2023 10:54:30 -0500	[thread overview]
Message-ID: <ffe7cc73-d2c7-d6d7-69e8-438a4a2f7be6@lwfinger.net> (raw)
In-Reply-To: <20230823075021.588596-1-s.hauer@pengutronix.de>

On 8/23/23 02:50, Sascha Hauer wrote:
> After rtw_usb_alloc_rx_bufs() has been called rx urbs have been
> allocated and must be freed in the error path. After rtw_usb_init_rx()
> has been called they are submitted, so they also must be killed.
> 
> Add these forgotten steps to the probe error path.
> 
> Besides the lost memory this also fixes a problem when the driver
> fails to download the firmware in rtw_chip_info_setup(). In this
> case it can happen that the completion of the rx urbs handler runs
> at a time when we already freed our data structures resulting in
> a kernel crash.
> 
> fixes: a82dfd33d1237 ("wifi: rtw88: Add common USB chip support")
> Cc: stable@vger.kernel.org
> Reported-by: Ilgaz Öcal <ilgaz@ilgaz.gen.tr>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>   drivers/net/wireless/realtek/rtw88/usb.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
> index 4a57efdba97bb..875a61c9c80d4 100644
> --- a/drivers/net/wireless/realtek/rtw88/usb.c
> +++ b/drivers/net/wireless/realtek/rtw88/usb.c
> @@ -844,7 +844,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
>   
>   	ret = rtw_core_init(rtwdev);
>   	if (ret)
> -		goto err_release_hw;
> +		goto err_free_rx_bufs;
>   
>   	ret = rtw_usb_intf_init(rtwdev, intf);
>   	if (ret) {
> @@ -890,6 +890,9 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
>   err_deinit_core:
>   	rtw_core_deinit(rtwdev);
>   
> +err_free_rx_bufs:
> +	rtw_usb_free_rx_bufs(rtwusb);
> +
>   err_release_hw:
>   	ieee80211_free_hw(hw);
>   

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

Thanks Sasha,

Larry


  parent reply	other threads:[~2023-08-23 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  7:50 Sascha Hauer
2023-08-23 10:14 ` Kalle Valo
2023-08-23 15:54 ` Larry Finger [this message]
2023-08-25  1:13 ` Ping-Ke Shih
2023-08-25 10:02 ` Kalle Valo

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=ffe7cc73-d2c7-d6d7-69e8-438a4a2f7be6@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=ilgaz@ilgaz.gen.tr \
    --cc=kernel@pengutronix.de \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=s.hauer@pengutronix.de \
    /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

all inboxes | Powered by JetHome®