]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: add NULL check for PCIe Rx skb
authorAmitkumar Karwar <akarwar@marvell.com>
Tue, 18 Feb 2014 23:41:55 +0000 (15:41 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 20 Feb 2014 20:53:20 +0000 (15:53 -0500)
We may get a NULL pointer here if skb allocation for Rx packet
was failed earlier.

Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/pcie.c

index 03688aa14e8adb8575163e3a40aeda4a70a32c19..28029b7522c21c422065e8f5031a31ea9ff9594f 100644 (file)
@@ -1211,6 +1211,12 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
                rd_index = card->rxbd_rdptr & reg->rx_mask;
                skb_data = card->rx_buf_list[rd_index];
 
+               /* If skb allocation was failed earlier for Rx packet,
+                * rx_buf_list[rd_index] would have been left with a NULL.
+                */
+               if (!skb_data)
+                       return -ENOMEM;
+
                MWIFIEX_SKB_PACB(skb_data, &buf_pa);
                pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE,
                                 PCI_DMA_FROMDEVICE);