if rtlpriv->use_new_trx_flow == true and we run out of memory
to alloc a new skb, we will directly jump to no_new tag with
buffer_desc == NULL. Then we will dereference this NULL pointer
in function _rtl_pci_init_one_rxdesc.
Signed-off-by: Yang Bai <redacted>
---
drivers/net/wireless/rtlwifi/pci.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
@@ -820,17 +820,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)pci_unmap_single(rtlpci->pdev,*((dma_addr_t*)skb->cb),rtlpci->rxbuffersize,PCI_DMA_FROMDEVICE);+if(rtlpriv->use_new_trx_flow)+buffer_desc=+&rtlpci->rx_ring[rxring_idx].buffer_desc+[rtlpci->rx_ring[rxring_idx].idx];+/* get a new skb - if fail, old one will be reused */new_skb=dev_alloc_skb(rtlpci->rxbuffersize);if(unlikely(!new_skb))gotono_new;-if(rtlpriv->use_new_trx_flow){-buffer_desc=-&rtlpci->rx_ring[rxring_idx].buffer_desc-[rtlpci->rx_ring[rxring_idx].idx];+if(rtlpriv->use_new_trx_flow)/*means rx wifi info*/pdesc=(structrtl_rx_desc*)skb->data;-}+memset(&rx_status,0,sizeof(rx_status));rtlpriv->cfg->ops->query_rx_desc(hw,&stats,&rx_status,(u8*)pdesc,skb);
From: Larry Finger <hidden> Date: 2015-03-12 16:03:06
On 03/12/2015 06:33 AM, Yang Bai wrote:
if rtlpriv->use_new_trx_flow == true and we run out of memory
to alloc a new skb, we will directly jump to no_new tag with
buffer_desc == NULL. Then we will dereference this NULL pointer
in function _rtl_pci_init_one_rxdesc.
Signed-off-by: Yang Bai <redacted>
Good catch. The only problem that I have is this fix adds even more branching to
this interrupt routine. At first glance, I should be able to set buffer_desc in
the earlier code where the code has already branched. For testing, an RTL8192EE
card will be needed. Do you have such a card?
Larry
@@ -820,17 +820,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)pci_unmap_single(rtlpci->pdev,*((dma_addr_t*)skb->cb),rtlpci->rxbuffersize,PCI_DMA_FROMDEVICE);+if(rtlpriv->use_new_trx_flow)+buffer_desc=+&rtlpci->rx_ring[rxring_idx].buffer_desc+[rtlpci->rx_ring[rxring_idx].idx];+/* get a new skb - if fail, old one will be reused */new_skb=dev_alloc_skb(rtlpci->rxbuffersize);if(unlikely(!new_skb))gotono_new;-if(rtlpriv->use_new_trx_flow){-buffer_desc=-&rtlpci->rx_ring[rxring_idx].buffer_desc-[rtlpci->rx_ring[rxring_idx].idx];+if(rtlpriv->use_new_trx_flow)/*means rx wifi info*/pdesc=(structrtl_rx_desc*)skb->data;-}+memset(&rx_status,0,sizeof(rx_status));rtlpriv->cfg->ops->query_rx_desc(hw,&stats,&rx_status,(u8*)pdesc,skb);
From: Larry Finger <hidden> Date: 2015-03-12 17:29:38
On 03/12/2015 06:33 AM, Yang Bai wrote:
if rtlpriv->use_new_trx_flow == true and we run out of memory
to alloc a new skb, we will directly jump to no_new tag with
buffer_desc == NULL. Then we will dereference this NULL pointer
in function _rtl_pci_init_one_rxdesc.
Signed-off-by: Yang Bai <redacted>
Is the attached patch OK? I have tested it, but it is unlikely that I have hit
any memory failures, thus that part needs to be checked by eye.
Larry
On Fri, Mar 13, 2015 at 1:29 AM, Larry Finger [off-list ref] wrote:
On 03/12/2015 06:33 AM, Yang Bai wrote:
quoted
if rtlpriv->use_new_trx_flow == true and we run out of memory
to alloc a new skb, we will directly jump to no_new tag with
buffer_desc == NULL. Then we will dereference this NULL pointer
in function _rtl_pci_init_one_rxdesc.
Signed-off-by: Yang Bai <redacted>
Is the attached patch OK? I have tested it, but it is unlikely that I have
hit any memory failures, thus that part needs to be checked by eye.
Looks good to me. Thanks very much for your review.
Yang
Larry
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html