Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Yang Yingliang <yangyingliang@huawei.com>,
	"kvalo@kernel.org" <kvalo@kernel.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH resend 1/3] rtlwifi: rtl8821ae: don't call kfree_skb() under spin_lock_irqsave()
Date: Wed, 7 Dec 2022 03:31:01 +0000	[thread overview]
Message-ID: <758b8caa9e8243bb84471baf50706e6d@realtek.com> (raw)
In-Reply-To: <20221206131249.2181693-2-yangyingliang@huawei.com>


> -----Original Message-----
> From: Yang Yingliang <yangyingliang@huawei.com>
> Sent: Tuesday, December 6, 2022 9:13 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; kvalo@kernel.org
> Cc: linux-wireless@vger.kernel.org; yangyingliang@huawei.com
> Subject: [PATCH resend 1/3] rtlwifi: rtl8821ae: don't call kfree_skb() under spin_lock_irqsave()
> 
> It is not allowed to call kfree_skb() from hardware interrupt
> context or with interrupts being disabled. So add all skb to
> a free list, then free them after spin_unlock_irqrestore() at
> once.

The patch doesn't change logic, so it should work. But, I would like to know
if there is a comment about this in kernel code. Could you point it out?

> 
> Fixes: 5c99f04fec93 ("rtlwifi: rtl8723be: Update driver to match Realtek release of 06/28/14")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> index 7e0f62d59fe1..a7e3250957dc 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
> @@ -26,8 +26,10 @@ static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw)
>  	struct rtl_priv *rtlpriv = rtl_priv(hw);
>  	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
>  	struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE];
> +	struct sk_buff_head free_list;
>  	unsigned long flags;
> 
> +	skb_queue_head_init(&free_list);
>  	spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
>  	while (skb_queue_len(&ring->queue)) {
>  		struct rtl_tx_desc *entry = &ring->desc[ring->idx];
> @@ -37,10 +39,12 @@ static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw)
>  				 rtlpriv->cfg->ops->get_desc(hw, (u8 *)entry,
>  						true, HW_DESC_TXBUFF_ADDR),
>  				 skb->len, DMA_TO_DEVICE);
> -		kfree_skb(skb);
> +		__skb_queue_tail(&free_list, skb);
>  		ring->idx = (ring->idx + 1) % ring->entries;
>  	}
>  	spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
> +
> +	__skb_queue_purge(&free_list);
>  }
> 
>  static void _rtl8821ae_set_bcn_ctrl_reg(struct ieee80211_hw *hw,
> --
> 2.25.1
> 
> 
> ------Please consider the environment before printing this e-mail.

  reply	other threads:[~2022-12-07  3:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 13:12 [PATCH resend 0/3] rtlwifi: don't call kfree_skb() under spin_lock_irqsave() Yang Yingliang
2022-12-06 13:12 ` [PATCH resend 1/3] rtlwifi: rtl8821ae: " Yang Yingliang
2022-12-07  3:31   ` Ping-Ke Shih [this message]
2022-12-07  3:44     ` Yang Yingliang
2022-12-07  3:52       ` Ping-Ke Shih
2022-12-07  4:41         ` Yang Yingliang
2022-12-07  5:07           ` Ping-Ke Shih
2022-12-06 13:12 ` [PATCH resend 2/3] rtlwifi: rtl8188ee: " Yang Yingliang
2022-12-06 13:12 ` [PATCH resend 3/3] rtlwifi: rtl8723be: " Yang Yingliang

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=758b8caa9e8243bb84471baf50706e6d@realtek.com \
    --to=pkshih@realtek.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yangyingliang@huawei.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