lkml.org 
[lkml]   [2020]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] atm: idt77252: avoid accessing the data mapped to streaming DMA
From
From: Jia-Ju Bai <baijiaju@tsinghua.edu.cn>
Date: Sun, 2 Aug 2020 17:33:40 +0800

> 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: Jia-Ju Bai <baijiaju@tsinghua.edu.cn>

Applied.

\
 
 \ /
  Last update: 2020-08-04 00:52    [W:0.033 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site