From: David Miller <davem@davemloft.net>
To: baijiaju@tsinghua.edu.cn
Cc: 3chas3@gmail.com, linux-atm-general@lists.sourceforge.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] atm: idt77252: avoid accessing the data mapped to streaming DMA
Date: Mon, 03 Aug 2020 15:51:44 -0700 (PDT) [thread overview]
Message-ID: <20200803.155144.1285440527272961526.davem@davemloft.net> (raw)
In-Reply-To: <20200802093340.3475-1-baijiaju@tsinghua.edu.cn>
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.
prev parent reply other threads:[~2020-08-03 22:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-02 9:33 [PATCH] atm: idt77252: avoid accessing the data mapped to streaming DMA Jia-Ju Bai
2020-08-03 22:51 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200803.155144.1285440527272961526.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=3chas3@gmail.com \
--cc=baijiaju@tsinghua.edu.cn \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).