Skip to content

Commit

Permalink
rtlwifi: Fix kernel oops introduced with commit e496561
Browse files Browse the repository at this point in the history
With commit e496561 {"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: e496561 ("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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Larry Finger authored and Kalle Valo committed Dec 21, 2016
1 parent d1f1c0e commit 22b68b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/realtek/rtlwifi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,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];
Expand Down

0 comments on commit 22b68b9

Please sign in to comment.