]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rtw88: fix potential NULL skb access in TX ISR
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Tue, 7 Jan 2020 08:08:07 +0000 (16:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:58 +0000 (08:36 +0100)
[ Upstream commit f4f84ff8377d4cedf18317747bc407b2cf657d0f ]

Sometimes the TX queue may be empty and we could possible
dequeue a NULL pointer, crash the kernel. If the skb is NULL
then there is nothing to do, just leave the ISR.

And the TX queue should not be empty here, so print an error
to see if there is anything wrong for DMA ring.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtw88/pci.c

index d90928be663b910c3d5cb88f54a7e5f2fe4d6d17..77a2bdee50fa774bd99c35aa9ac347044c59c5e4 100644 (file)
@@ -762,6 +762,11 @@ static void rtw_pci_tx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci,
 
        while (count--) {
                skb = skb_dequeue(&ring->queue);
+               if (!skb) {
+                       rtw_err(rtwdev, "failed to dequeue %d skb TX queue %d, BD=0x%08x, rp %d -> %d\n",
+                               count, hw_queue, bd_idx, ring->r.rp, cur_rp);
+                       break;
+               }
                tx_data = rtw_pci_get_tx_data(skb);
                pci_unmap_single(rtwpci->pdev, tx_data->dma, skb->len,
                                 PCI_DMA_TODEVICE);