Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3060589pxa; Tue, 18 Aug 2020 05:45:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywH0lOPYqbGVEZEi9SIVe1sXeSahIhhk0uIHAoPJiB2zH2DfG/aTIByNAVknenyrgfutYg X-Received: by 2002:a05:6402:3128:: with SMTP id dd8mr19014392edb.97.1597754712385; Tue, 18 Aug 2020 05:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597754712; cv=none; d=google.com; s=arc-20160816; b=X5plVyBJVImzWWXTSpvclKuylAmwfbayA55m2izxPd/lRWX0QQNx7qVc+4zWeDyLiU 7rLWtldGMxNKrTM2eNsWQtNFmGt+7ZpZ4+CNDvUZ3c71PGz7iWpMJaDPlMYZtVN/Yf3G q0D3ZIEXxsC75e8lb7dtStHHfdOZJMIH54agRdD1cR/HxqSmqX+RihlTKbpEeUG/IVnh 4FKPG1Sn72ETMbdZJ642AKW4rr1Wq90jfPj24UevuylLAMqtryKZMLsgYeoRH8L5cnHK ArmG1049u+5Ur9iYbdBqzQDXU+LZLOPZIlV4N5IW8aXV3IGVZduIjwr41cD44dOg64EU 0gNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:user-agent:cc:to :references:in-reply-to:from:subject:content-transfer-encoding :mime-version:dmarc-filter:dkim-signature; bh=Y/RDDb3mAt7QvX6HBbapdibqafkKhm7pXFr4Ti4glJk=; b=euXQb6YGWdH9o3Ea/uIQ3EuQ/aVRd1VHwvAFmShS+VL3PtAbd+9VPo5BAAYpf5ZePg GCRQ4ywG5l/JkhWPA8VO+KBfWBlxNS9tKIeOfla0J3TgZK5M3EDTvASBGI717bMI73JB cX/EdWDTlMSusKtmvBD17k0c8r3SMjIUG1gKyx9cXKq6Lt/GyRCvWWURZ6ktroLASf5g 2/MtD0qjtrU8Mu3dS87npckbF1jXKopu5STqcnN3hRCg1zhePYB3rQsWADGyBzUgPl0/ wvx/2iqIQzyQdQxaQRPg39tYaXtfnfcGZvBxgq07sE4QOWp0N+jOCZXcRYVevlsKJiii lB0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=gQ8gkyFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si14013377eje.669.2020.08.18.05.44.47; Tue, 18 Aug 2020 05:45:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=gQ8gkyFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726451AbgHRMmU (ORCPT + 99 others); Tue, 18 Aug 2020 08:42:20 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:60313 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbgHRMmM (ORCPT ); Tue, 18 Aug 2020 08:42:12 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597754525; h=Date: Message-Id: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=Y/RDDb3mAt7QvX6HBbapdibqafkKhm7pXFr4Ti4glJk=; b=gQ8gkyFKgBfUqMky+MoyJ7oD6eJFu0X8sNATKPOdGtUn0Oxk1YXEB5jdu/4i/uwsqKsq6fIw AAMCNgPUMBELRxgNIaYnhIDJXmEbXKPRbsTE5AmMUGHm7kIDs3BeHtkQjgWEsQsqbY2VePpP MsJESlFctnhv6Q0bNKsIT7nWxW4= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-west-2.postgun.com with SMTP id 5f3bcc8bd96d28d61efbd3df (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 18 Aug 2020 12:41:47 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 27D1DC43391; Tue, 18 Aug 2020 12:41:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=0.5 required=2.0 tests=ALL_TRUSTED,MISSING_DATE, MISSING_MID,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 96AC0C433CA; Tue, 18 Aug 2020 12:41:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 96AC0C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] p54: avoid accessing the data mapped to streaming DMA From: Kalle Valo In-Reply-To: <20200802132949.26788-1-baijiaju@tsinghua.edu.cn> References: <20200802132949.26788-1-baijiaju@tsinghua.edu.cn> To: Jia-Ju Bai Cc: chunkeey@googlemail.com, davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.5.2 Message-Id: <20200818124147.27D1DC43391@smtp.codeaurora.org> Date: Tue, 18 Aug 2020 12:41:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jia-Ju Bai wrote: > In p54p_tx(), skb->data is mapped to streaming DMA on line 337: > mapping = pci_map_single(..., skb->data, ...); > > Then skb->data is accessed on line 349: > desc->device_addr = ((struct p54_hdr *)skb->data)->req_id; > > This access may cause data inconsistency between CPU cache and hardware. > > To fix this problem, ((struct p54_hdr *)skb->data)->req_id 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 Can someone review this? -- https://patchwork.kernel.org/patch/11696391/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches