Skip to content

Commit be0b5e6

Browse files
lwfingerKalle Valo
authored andcommitted
rtlwifi: Fix IOMMU mapping leak in AP mode
Transmission of an AP beacon does not call the TX interrupt service routine, which usually does the cleanup. Instead, cleanup is handled in a tasklet completion routine. Unfortunately, this routine has a serious bug in that it does not release the DMA mapping before it frees the skb, thus one IOMMU mapping is leaked for each beacon. The test system failed with no free IOMMU mapping slots approximately one hour after hostapd was used to start an AP. This issue was reported and tested at https://github.com/lwfinger/rtlwifi_new/issues/30. Reported-and-tested-by: Kevin Mullican <[email protected]> Cc: Kevin Mullican <[email protected]> Signed-off-by: Shao Fu <[email protected]> Signed-off-by: Larry Finger <[email protected]> Cc: Stable <[email protected]> [3.18+] Signed-off-by: Kalle Valo <[email protected]>
1 parent f93a25b commit be0b5e6

File tree

1 file changed

+11
-1
lines changed
  • drivers/net/wireless/rtlwifi

1 file changed

+11
-1
lines changed

drivers/net/wireless/rtlwifi/pci.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,12 +1124,22 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
11241124
/*This is for new trx flow*/
11251125
struct rtl_tx_buffer_desc *pbuffer_desc = NULL;
11261126
u8 temp_one = 1;
1127+
u8 *entry;
11271128

11281129
memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
11291130
ring = &rtlpci->tx_ring[BEACON_QUEUE];
11301131
pskb = __skb_dequeue(&ring->queue);
1131-
if (pskb)
1132+
if (rtlpriv->use_new_trx_flow)
1133+
entry = (u8 *)(&ring->buffer_desc[ring->idx]);
1134+
else
1135+
entry = (u8 *)(&ring->desc[ring->idx]);
1136+
if (pskb) {
1137+
pci_unmap_single(rtlpci->pdev,
1138+
rtlpriv->cfg->ops->get_desc(
1139+
(u8 *)entry, true, HW_DESC_TXBUFF_ADDR),
1140+
pskb->len, PCI_DMA_TODEVICE);
11321141
kfree_skb(pskb);
1142+
}
11331143

11341144
/*NB: the beacon data buffer must be 32-bit aligned. */
11351145
pskb = ieee80211_beacon_get(hw, mac->vif);

0 commit comments

Comments
 (0)