Re: [PATCH] rtl8180: avoid accessing the data mapped to streaming DMA
From: Jakub Kicinski
Date: Mon Oct 19 2020 - 14:43:24 EST
On Mon, 19 Oct 2020 10:54:20 +0800 Jia-Ju Bai wrote:
> + if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
> + if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
> + priv->seqno += 0x10;
> + hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
> + hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
> + }
> +
> mapping = dma_map_single(&priv->pdev->dev, skb->data, skb->len,
> DMA_TO_DEVICE);
>
> @@ -534,13 +541,6 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
>
> spin_lock_irqsave(&priv->lock, flags);
>
> - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
> - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
> - priv->seqno += 0x10;
You're taking the priv->seqno access and modification from under
priv->lock. Is that okay?