rtlwifi: Fix kernel oops introduced with commit e496561473

With commit e496561473 {"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: e496561473 ("rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb")
Signed-off-by: Larry Finger <[email protected]>
Cc: Stable <[email protected]> # 4.9+
Cc: Wei Yongjun <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
This commit is contained in:
Larry Finger authored and Kalle Valo committed 2016-12-21 16:34:16 +02:00
1 parent d1f1c0e289
commit 22b68b93ae
1 file changed
+2 -1
+2 -1
View File
@@ -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];