Received: by 10.192.165.148 with SMTP id m20csp3878112imm; Mon, 7 May 2018 22:07:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQU9MVHJrJIV/NK2JRKs0A2qjQvpSIcad/bBsdUOdIekBMBPDpJi22tuAaGMN7mkUeQdYr X-Received: by 2002:a65:4204:: with SMTP id c4-v6mr1250960pgq.26.1525756034780; Mon, 07 May 2018 22:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525756034; cv=none; d=google.com; s=arc-20160816; b=eLrPBPA4y3bNJPn9mlMmLTVhVfTSXg5cSybQqGfuRnCPzlcwlTKse90vnEECzZJRxB EiLymmorkWWiWbYfCAOqRjBclK3OKrRiej/Qkt3g2MIuVXBKvq5IDtz9xZ9PDJZVQ8ST 4OhEgrjsIwtBbg4/nvbY+2oCTaXIIzSAyx891+F/DgTpiBFZh6W/FeVOSRXSN54aXkyb dFC4ktYBmMIQC3SQCfYp7wEeiQiYhhQpCMXomE/VtMg9xJN5oRYIDWpfGukhqf4xmHff iBYFysYOT2iIhD5SSG/FptcNV6K2sixT3CEnXU7ewR8krsd7Au03j0VoxGnoKx6+abqp INQQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=hCQi/Gtl138nm4HRWJX7N4OBa3ZrEutOjF4vpPK0Y9M=; b=F/BLWBwVru4075C0/DeJjJUQgKs4BB0nSnjSNI2ALo0fpXQfiG7sju5zIDLzaRy/dP 9KVdyY3tkWs7TTpYKVu99LzNcpAoJpT5My8G0I9HBfivPkj+itLVb704MywQbjkXZhQC fhONM47+XjLMGgvQZLH6fd5gqErWkP9sbPoDUsGPQ7JVHodgKqQcUQyGt6P8a/MiGblb w5MrZoHW/IzK/yKCXuJakUedR6bJahJ7QzwbxEEXPxLdLjJb+s2B8h4DO8rf3D9rJ7HC dfYijAJStuW3zNXCfxZ5QoNAn9hrZYXLN+5n0oVcBooVVi5kDwEdud4sBXDj6oeUQKcz WIUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e4xYrRP7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5-v6si23315247pll.449.2018.05.07.22.06.47; Mon, 07 May 2018 22:07:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e4xYrRP7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753460AbeEHFE4 (ORCPT + 99 others); Tue, 8 May 2018 01:04:56 -0400 Received: from mail-pl0-f52.google.com ([209.85.160.52]:34305 "EHLO mail-pl0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeEHFEy (ORCPT ); Tue, 8 May 2018 01:04:54 -0400 Received: by mail-pl0-f52.google.com with SMTP id ay10-v6so1488360plb.1; Mon, 07 May 2018 22:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hCQi/Gtl138nm4HRWJX7N4OBa3ZrEutOjF4vpPK0Y9M=; b=e4xYrRP7SDKDQ6KncdlrlwWZmRzKxmquBAnklyl9Y9wdZ5azeAnYhFWXxINPNFpDAJ VUNEIFDbwudEIY0OO2lguGi6660uU5tkDtBpgmVUrwRPflgnmsf1iJFLpN7W+lYX0R45 KQ8iRXAAGSFt9E3sliCzVYB3xzDTciWeYEwdIr3xHqDMtWijqFnfycdJHyNdgfFicTuN drWonEKnFAzN6GKrq+7nfbwfdCVsFPaiz7C/DuDxUxcoq0Lj7mt8z0a0uZ0/1XO4RR5a 0g+MiXE0Vf1bnT8Nq9ovMvL3NEi0X2Wwd+KcwowQbdMvDgaYqKRm+ewjWCvyPBvJcf4L Hj7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hCQi/Gtl138nm4HRWJX7N4OBa3ZrEutOjF4vpPK0Y9M=; b=omU+tJI4/lc2pkdgHWsQD2CSzYk8TIQPTRrh+nHl85irJFByKNf3qLlYUnPYwpPXMb TgeMjDjkHTHNpYuJgWqEb2is/N5n6xqV6joEOpPVU2eWyPOWP4os9BYfnVIOoMjY0GnU c1jPvTBcEevUrhKHlgnBRbMCVqIoAY3PLpTAbnalGmK2dNSc55H/2hhVXZp6pGB9V4NW fva/BBfQ9kQn2cBWgInm69ZVgzfGcwRn418Giztsw47xFNs2LT+fZGUhjStpGl2SLAIS s6GBQDcd+pdkFw0h5svbegVrRztemrbJeNOjFbkdFpNDRl2wrMCGhlEq39yLKckbG5YJ CRSg== X-Gm-Message-State: ALQs6tBz/YkqFiaFpODGCXoYKVsW2aUDonCNPZKyQq/ZeT+IzbRIHByd Uq/2lfn/5/uKyJdAL48tZJMOgwSb X-Received: by 2002:a17:902:7e4a:: with SMTP id a10-v6mr40503214pln.276.1525755893918; Mon, 07 May 2018 22:04:53 -0700 (PDT) Received: from [192.168.86.235] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.gmail.com with ESMTPSA id w12sm10036981pfi.158.2018.05.07.22.04.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 22:04:52 -0700 (PDT) Subject: Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats To: Jia-Ju Bai , davem@davemloft.net, fthain@telegraphics.com.au, joe@perches.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180507140809.28847-1-baijiaju1990@gmail.com> <6fe51782-2169-53c8-9bac-1715262e716d@gmail.com> From: Eric Dumazet Message-ID: Date: Mon, 7 May 2018 22:04:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <6fe51782-2169-53c8-9bac-1715262e716d@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: > Yes, "&dev->stats" will not change, because it is a fixed address. > But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors and rx_missed_errors). > So if the driver returns "&dev->stats" without lock protection (like on line 858), the field data value of this return value can be the changed field data value or unchanged field data value. We do not care. This function can be called by multiple cpus at the same time. As soon as one cpu returns from it, another cpu can happily modify dev->stats.ANYFIELD. Your patch fixes nothing at all.