Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtlwifi: Fix kernel oops introduced with commit e49656147359

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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Larry Finger and committed by
Kalle Valo
22b68b93 d1f1c0e2

+2 -1
+2 -1
drivers/net/wireless/realtek/rtlwifi/core.c
··· 1829 1829 1830 1830 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); 1831 1831 pskb = __skb_dequeue(&ring->queue); 1832 - dev_kfree_skb_irq(pskb); 1832 + if (pskb) 1833 + dev_kfree_skb_irq(pskb); 1833 1834 1834 1835 /*this is wrong, fill_tx_cmddesc needs update*/ 1835 1836 pdesc = &ring->desc[0];