linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359
@ 2016-12-20  2:38 Larry Finger
  2016-12-20 11:21 ` Kalle Valo
  2016-12-21 14:35 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Larry Finger @ 2016-12-20  2:38 UTC (permalink / raw)
  To: kvalo, Linus Torvalds
  Cc: devel, linux-wireless, Larry Finger, linux-kernel, driver-devel,
	Stable, Wei Yongjun

With commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of
kfree_skb"), the method used to free an skb was changed because the
kfree_skb() was inside a spinlock. What was forgotten is that kfree_skb()
guards against a NULL value for the argument. Routine dev_kfree_skb_irq()
does not, and a test is needed to prevent kernel panics.

Fixes: commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> (4.9+)
Cc: Wei Yongjun <weiyongjun1@huawei.com>
---
Kalle,

This change should be sent to mainline during the 4.10 merge period,
or as soon as possible.

Thanks,

Larry
---
 drivers/net/wireless/realtek/rtlwifi/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index 955055b..df8b977 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1823,7 +1823,8 @@ bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
 
 	spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
 	pskb = __skb_dequeue(&ring->queue);
-	dev_kfree_skb_irq(pskb);
+	if (pskb)
+		dev_kfree_skb_irq(pskb);
 
 	/*this is wrong, fill_tx_cmddesc needs update*/
 	pdesc = &ring->desc[0];
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359
  2016-12-20  2:38 [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359 Larry Finger
@ 2016-12-20 11:21 ` Kalle Valo
  2016-12-20 15:25   ` Larry Finger
  2016-12-21 14:35 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2016-12-20 11:21 UTC (permalink / raw)
  To: Larry Finger
  Cc: Linus Torvalds, devel, linux-wireless, linux-kernel,
	driver-devel, Stable, Wei Yongjun

Larry Finger <Larry.Finger@lwfinger.net> writes:

> With commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of
> kfree_skb"), the method used to free an skb was changed because the
> kfree_skb() was inside a spinlock. What was forgotten is that kfree_skb()
> guards against a NULL value for the argument. Routine dev_kfree_skb_irq()
> does not, and a test is needed to prevent kernel panics.
>
> Fixes: commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")

This should be:

Fixes: e49656147359 ("rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")

> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org> (4.9+)

And this:

Cc: Stable <stable@vger.kernel.org> # 4.9+

I can fix both of them.

> Cc: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> Kalle,
>
> This change should be sent to mainline during the 4.10 merge period,
> or as soon as possible.

Ok, I'll queue this to 4.10. Most likely I'll send a pull request to
Dave later this week or so.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359
  2016-12-20 11:21 ` Kalle Valo
@ 2016-12-20 15:25   ` Larry Finger
  0 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2016-12-20 15:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Linus Torvalds, devel, linux-wireless, linux-kernel,
	driver-devel, Stable, Wei Yongjun

On 12/20/2016 05:21 AM, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
>
>> With commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of
>> kfree_skb"), the method used to free an skb was changed because the
>> kfree_skb() was inside a spinlock. What was forgotten is that kfree_skb()
>> guards against a NULL value for the argument. Routine dev_kfree_skb_irq()
>> does not, and a test is needed to prevent kernel panics.
>>
>> Fixes: commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")
>
> This should be:
>
> Fixes: e49656147359 ("rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")
>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> Cc: Stable <stable@vger.kernel.org> (4.9+)
>
> And this:
>
> Cc: Stable <stable@vger.kernel.org> # 4.9+
>
> I can fix both of them.
>
>> Cc: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>> Kalle,
>>
>> This change should be sent to mainline during the 4.10 merge period,
>> or as soon as possible.
>
> Ok, I'll queue this to 4.10. Most likely I'll send a pull request to
> Dave later this week or so.

Thanks for the suggested changes, and for the quick action.

Larry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rtlwifi: Fix kernel oops introduced with commit e49656147359
  2016-12-20  2:38 [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359 Larry Finger
  2016-12-20 11:21 ` Kalle Valo
@ 2016-12-21 14:35 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2016-12-21 14:35 UTC (permalink / raw)
  To: Larry Finger
  Cc: Linus Torvalds, devel, linux-wireless, Larry Finger,
	linux-kernel, driver-devel, Stable, Wei Yongjun

Larry Finger <Larry.Finger@lwfinger.net> wrote:
> With commit e49656147359 {"rtlwifi: Use dev_kfree_skb_irq instead of
> kfree_skb"), the method used to free an skb was changed because the
> kfree_skb() was inside a spinlock. What was forgotten is that kfree_skb()
> guards against a NULL value for the argument. Routine dev_kfree_skb_irq()
> does not, and a test is needed to prevent kernel panics.
> 
> Fixes: e49656147359 ("rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org> # 4.9+
> Cc: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied to wireless-drivers.git, thanks.

22b68b93ae25 rtlwifi: Fix kernel oops introduced with commit e49656147359

-- 
https://patchwork.kernel.org/patch/9481055/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-21 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20  2:38 [PATCH] rtlwifi: Fix kernel oops introduced with commit e49656147359 Larry Finger
2016-12-20 11:21 ` Kalle Valo
2016-12-20 15:25   ` Larry Finger
2016-12-21 14:35 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).