Skip to content
Snippets Groups Projects
Commit cbbb64f6 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by David S. Miller
Browse files

atm: idt77252: avoid accessing the data mapped to streaming DMA


In queue_skb(), skb->data is mapped to streaming DMA on line 850:
  dma_map_single(..., skb->data, ...);

Then skb->data is accessed on lines 862 and 863:
  tbd->word_4 = (skb->data[0] << 24) | (skb->data[1] << 16) |
           (skb->data[2] <<  8) | (skb->data[3] <<  0);
and on lines 893 and 894:
  tbd->word_4 = (skb->data[0] << 24) | (skb->data[1] << 16) |
           (skb->data[2] <<  8) | (skb->data[3] <<  0);

These accesses may cause data inconsistency between CPU cache and
hardware.

To fix this problem, the calculation result of skb->data is stored in a
local variable before DMA mapping, and then the driver accesses this
local variable instead of skb->data.

Signed-off-by: default avatarJia-Ju Bai <baijiaju@tsinghua.edu.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a45a9e8a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment