All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Kalle Valo <kvalo@kernel.org>,
	"kernel-dev@igalia.com" <kernel-dev@igalia.com>
Subject: RE: [PATCH net 3/5] wifi: rtlwifi: wait for firmware loading before releasing memory
Date: Fri, 8 Nov 2024 02:12:24 +0000	[thread overview]
Message-ID: <fe600a9588e045658ef4415e1ceb4983@realtek.com> (raw)
In-Reply-To: <20241107133322.855112-4-cascardo@igalia.com>

Thadeu Lima de Souza Cascardo <cascardo@igalia.com> wrote:
> At probe error path, the firmware loading work may have already been
> queued. In such a case, it will try to access memory allocated by the probe
> function, which is about to be released. In such paths, wait for the
> firmware worker to finish before releasing memory.
> 
> Fixes: a7f7c15e945a ("rtlwifi: rtl8192cu: Free ieee80211_hw if probing fails")
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
> ---
>  drivers/net/wireless/realtek/rtlwifi/usb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
> index c3aa0cd9ff21..c27b116ccdff 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/usb.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
> @@ -1028,13 +1028,15 @@ int rtl_usb_probe(struct usb_interface *intf,
>         err = ieee80211_register_hw(hw);
>         if (err) {
>                 pr_err("Can't register mac80211 hw.\n");
> -               goto error_out;
> +               goto error_init_vars;
>         }
>         rtlpriv->mac80211.mac80211_registered = 1;
> 
>         set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
>         return 0;
> 
> +error_init_vars:
> +       wait_for_completion(&rtlpriv->firmware_loading_complete);

The firmware request is trigged by rtlpriv->cfg->ops->init_sw_vars(hw), and
here is wait for filling rtlpriv->rtlhal.pfirmware and
rtlpriv->rtlhal.wowlan_firmware.
 
The rtlpriv->cfg->ops->deinit_sw_vars(hw) is to free firmware. Shouldn't we
call it here? Also shouldn't PCI need this?

>  error_out:
>         rtl_deinit_core(hw);
>  error_out2:
> --
> 2.34.1


  reply	other threads:[~2024-11-08  2:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 13:33 [PATCH net 0/5] wifi: rtlwifi: usb probe error path fixes Thadeu Lima de Souza Cascardo
2024-11-07 13:33 ` [PATCH net 1/5] wifi: rtlwifi: do not complete firmware loading needlessly Thadeu Lima de Souza Cascardo
2024-11-08  1:57   ` Ping-Ke Shih
2024-11-18  1:55   ` Ping-Ke Shih
2024-11-07 13:33 ` [PATCH net 2/5] wifi: rtlwifi: rtl8192se: rise completion of firmware loading as last step Thadeu Lima de Souza Cascardo
2024-11-08  1:58   ` Ping-Ke Shih
2024-11-07 13:33 ` [PATCH net 3/5] wifi: rtlwifi: wait for firmware loading before releasing memory Thadeu Lima de Souza Cascardo
2024-11-08  2:12   ` Ping-Ke Shih [this message]
2024-11-08 11:05     ` Thadeu Lima de Souza Cascardo
2024-11-11  1:12       ` Ping-Ke Shih
2024-11-07 13:33 ` [PATCH net 4/5] wifi: rtlwifi: fix init_sw_vars leak when probe fails Thadeu Lima de Souza Cascardo
2024-11-08  2:14   ` Ping-Ke Shih
2024-11-07 13:33 ` [PATCH net 5/5] wifi: rtlwifi: usb: fix workqueue " Thadeu Lima de Souza Cascardo
2024-11-08  2:23   ` Ping-Ke Shih
2024-11-08 11:15     ` Thadeu Lima de Souza Cascardo
2024-11-11  2:58       ` Ping-Ke Shih
2024-11-08  1:41 ` [PATCH net 0/5] wifi: rtlwifi: usb probe error path fixes Ping-Ke Shih
2024-11-08 10:55   ` Thadeu Lima de Souza Cascardo
2024-11-11 11:33     ` 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=fe600a9588e045658ef4415e1ceb4983@realtek.com \
    --to=pkshih@realtek.com \
    --cc=cascardo@igalia.com \
    --cc=kernel-dev@igalia.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.