Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2418854pxa; Mon, 3 Aug 2020 16:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWCn9juh5YY6ubq5OF02HNDUGQ+qZ0GaRJqlJpGQE0VWaLj8H/Cbnvb7aGgBVRi6cK09sP X-Received: by 2002:a17:906:5ac8:: with SMTP id x8mr18771204ejs.486.1596495661233; Mon, 03 Aug 2020 16:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596495661; cv=none; d=google.com; s=arc-20160816; b=AEEREeWdF2V0PGnYW8xhXjxVwIavpgiVWybNwquA9uEoqHmFemN0SRtIgXn1kFpCG7 9qY+PBiHwCIt/AKovWKq0usaAGmeuaSOfwlQBMpvOBKdd7Miu8G9qEZq1cgPk0XhpGYK VtK+eSNTfQjTq+j1/gosa9ZFFkTQ7MpjcRbHJLCAXDwirLOWVaySVxQ8Zsp+CrpkvR0X S/SH+Kw6jIidhtjKCkNet051jwPL9NH+FtiFrFIDJNLd1t/+plFD7xYRwOALxpw1DOVX 9N22X+dNZ7xmbhEOTOtgqpb25/N/TcNvECRjtR8CZG/SkB4AF35vG4U/TmKDWH1QAp3G Pvcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=DcQ4ZnKv2hSeArm0n2ZdB4IBmpRapbEum1DHDY7t7JI=; b=DJ3hJB0eSa+OQqXoS9mUNvsKFaNMkemuCOW8BHOx9GRT83fVKCQGCrqQJ5bcRq5/Cp WCSOL26b4JSHFaSD+iSstgDdqseX4TMfTNpD4dMrMMxwRFoboYV0LxsCKxisOujPKXIc /7M/4YzdWFZTQS7aVqwxWEwiRb71JLiFyh0zkrjn7QUprkj57RCHhLAkIdSEvDQ8qy8E umeubqkX/wMHcdlglm37UisSiLyiLmVhCE2E8ZmQxRNB17d1AWEHvjk4M6FqYbaSQQSQ gSoN7yoeyiwMpPSHx4MeErOtYB9+K7tlg8XVUA4lDXUoFPIEvfXe9LPGuXS+szqnZTxw Jixg== ARC-Authentication-Results: i=1; mx.google.com; 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 d18si11366923ejm.684.2020.08.03.16.00.38; Mon, 03 Aug 2020 16:01:01 -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; 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 S1729000AbgHCW7v (ORCPT + 99 others); Mon, 3 Aug 2020 18:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728545AbgHCW7v (ORCPT ); Mon, 3 Aug 2020 18:59:51 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37236C06174A; Mon, 3 Aug 2020 15:59:51 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id CACAA1277916C; Mon, 3 Aug 2020 15:43:04 -0700 (PDT) Date: Mon, 03 Aug 2020 15:59:49 -0700 (PDT) Message-Id: <20200803.155949.39743839019093809.davem@davemloft.net> To: baijiaju@tsinghua.edu.cn Cc: doshir@vmware.com, pv-drivers@vmware.com, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: vmxnet3: avoid accessing the data mapped to streaming DMA From: David Miller In-Reply-To: <20200802131107.15857-1-baijiaju@tsinghua.edu.cn> References: <20200802131107.15857-1-baijiaju@tsinghua.edu.cn> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 03 Aug 2020 15:43:05 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai Date: Sun, 2 Aug 2020 21:11:07 +0800 > In vmxnet3_probe_device(), "adapter" is mapped to streaming DMA: > adapter->adapter_pa = dma_map_single(..., adapter, ...); > > Then "adapter" is accessed at many places in this function. > > Theses accesses may cause data inconsistency between CPU cache and > hardware. > > To fix this problem, dma_map_single() is called after these accesses. > > Signed-off-by: Jia-Ju Bai 'adapter' is accessed everywhere, in the entire driver, not just here in the probe function.