Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4051216ybe; Mon, 9 Sep 2019 03:27:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPa1LZqAk+e9zH/Ro1Q7jAN+Ujwjv1RghFxt75bCb9T4Gt0Hhau9fpR2NrLVh4rbrURm70 X-Received: by 2002:a05:6402:1598:: with SMTP id c24mr23456119edv.174.1568024847507; Mon, 09 Sep 2019 03:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568024847; cv=none; d=google.com; s=arc-20160816; b=Eg4Tkrzhb9iMfHFHlTlxuyoxsKvQd3IhPjeFuwLZ2dFPCCyrwsMDDckgRGyjW7PLIm zOrVQ6ECGvYmfDTGknW5icV5Wgu7x560yVWgyx8zLISaUQlXPXe/3kdD+vZ7WosTRkP2 f4qHNI0kfCw8SjO5js9SgY5bSSDqk5BFf4kDGiEPo2rNHXWijITjQ7PklBe38AL3qfMZ zsIMVDH7vyf4QARQHW3wNuXA0sMu9iCc17wc/4mUNukIPNQ0jkWOHYkilOiTQSbwQ3+w Tq4LhlSiSHAClD3KBRr1OX8x1JM9eKUNQlCp/zj5DE/6Cdg5VvUzSte+H3zhqEI+IbRR 0Hcg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/6Z27yydhJ8Ugww76YpkBsJ+L1HF7D6FWTnX0Sx4PDg=; b=tQo3DiCjYx8LI5rbW871XNB8zGXV5PwZsZSJxkG/w7DN3X7WiMG6TF/7EJEI72oRzf yj7I2C1uDeKJE7lnI3i/oF+wCjuPSQW2ttgmrZvtq5MtJxVUInx4p8MLPIzixWGXNxaT yCF2dyiQUYjYnGUc1m1Knawr0Oe996Gsdl/2/b1+FKdGWeQ4kD0SQQgmYoqkDlRjfupO TUysAxaYiUUve19Fd6Z/QlYn0ElFrx+dXueJwg6GXVcaCjbjj+uekRQiYnp3Zgx0YBzN UQ/uagqyFjQyS2D/zruhmejyrBG+oFAcUk4INmXqyI8pbODpj9dmF0rQ6FLP5thSxdwa 6rDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fXFRx7BI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si8130572edc.24.2019.09.09.03.27.03; Mon, 09 Sep 2019 03:27:27 -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=@kernel.org header.s=default header.b=fXFRx7BI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732198AbfIHMui (ORCPT + 99 others); Sun, 8 Sep 2019 08:50:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:41424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731378AbfIHMua (ORCPT ); Sun, 8 Sep 2019 08:50:30 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 704C221A49; Sun, 8 Sep 2019 12:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567947029; bh=zK8YeOYZRaVUJOgEQ5lJtHGcObCvzZmLvjmPpmxixIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fXFRx7BIK8kDQFK3ACkCd/pxDm37o5iSC4eUKHWsK/2G7yn55LbdAVHcu6T3+BWSt uqDN+MZJZ1bWGQSr0aBHArQzK3i+fllfRFEnGwNAVmOkwGy2uGPK0J5A5aCieOzfJh P/wsMfO/me45TJ5asR6fpaUoFDspYHXtNQwmBvGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dexuan Cui , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 34/94] hv_netvsc: Fix a warning of suspicious RCU usage Date: Sun, 8 Sep 2019 13:41:30 +0100 Message-Id: <20190908121151.415104561@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121150.420989666@linuxfoundation.org> References: <20190908121150.420989666@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 6d0d779dca73cd5acb649c54f81401f93098b298 ] This fixes a warning of "suspicious rcu_dereference_check() usage" when nload runs. Fixes: 776e726bfb34 ("netvsc: fix RCU warning in get_stats") Signed-off-by: Dexuan Cui Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/hyperv/netvsc_drv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 3544e19915792..e8fce6d715ef0 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1239,12 +1239,15 @@ static void netvsc_get_stats64(struct net_device *net, struct rtnl_link_stats64 *t) { struct net_device_context *ndev_ctx = netdev_priv(net); - struct netvsc_device *nvdev = rcu_dereference_rtnl(ndev_ctx->nvdev); + struct netvsc_device *nvdev; struct netvsc_vf_pcpu_stats vf_tot; int i; + rcu_read_lock(); + + nvdev = rcu_dereference(ndev_ctx->nvdev); if (!nvdev) - return; + goto out; netdev_stats_to_stats64(t, &net->stats); @@ -1283,6 +1286,8 @@ static void netvsc_get_stats64(struct net_device *net, t->rx_packets += packets; t->multicast += multicast; } +out: + rcu_read_unlock(); } static int netvsc_set_mac_addr(struct net_device *ndev, void *p) -- 2.20.1