@@ -572,8 +572,11 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
572572 dma_map_single (& rtlpci -> pdev -> dev , skb_tail_pointer (skb ),
573573 rtlpci -> rxbuffersize , DMA_FROM_DEVICE );
574574 bufferaddress = * ((dma_addr_t * )skb -> cb );
575- if (dma_mapping_error (& rtlpci -> pdev -> dev , bufferaddress ))
575+ if (dma_mapping_error (& rtlpci -> pdev -> dev , bufferaddress )) {
576+ if (!new_skb )
577+ kfree_skb (skb );
576578 return 0 ;
579+ }
577580 rtlpci -> rx_ring [rxring_idx ].rx_buf [desc_idx ] = skb ;
578581 if (rtlpriv -> use_new_trx_flow ) {
579582 /* skb->cb may be 64 bit address */
@@ -802,13 +805,19 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
802805 skb = new_skb ;
803806no_new :
804807 if (rtlpriv -> use_new_trx_flow ) {
805- _rtl_pci_init_one_rxdesc (hw , skb , (u8 * )buffer_desc ,
806- rxring_idx ,
807- rtlpci -> rx_ring [rxring_idx ].idx );
808+ if (!_rtl_pci_init_one_rxdesc (hw , skb , (u8 * )buffer_desc ,
809+ rxring_idx ,
810+ rtlpci -> rx_ring [rxring_idx ].idx )) {
811+ if (new_skb )
812+ dev_kfree_skb_any (skb );
813+ }
808814 } else {
809- _rtl_pci_init_one_rxdesc (hw , skb , (u8 * )pdesc ,
810- rxring_idx ,
811- rtlpci -> rx_ring [rxring_idx ].idx );
815+ if (!_rtl_pci_init_one_rxdesc (hw , skb , (u8 * )pdesc ,
816+ rxring_idx ,
817+ rtlpci -> rx_ring [rxring_idx ].idx )) {
818+ if (new_skb )
819+ dev_kfree_skb_any (skb );
820+ }
812821 if (rtlpci -> rx_ring [rxring_idx ].idx ==
813822 rtlpci -> rxringcount - 1 )
814823 rtlpriv -> cfg -> ops -> set_desc (hw , (u8 * )pdesc ,
0 commit comments