Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3421742pxf; Mon, 29 Mar 2021 01:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkB/ox2+yhKgrADQXg0v53A+nk5uBXkGRGelfJMAIj0JT7qqkpY02tpQxlMDd0+GdP2A3y X-Received: by 2002:a17:906:c0c8:: with SMTP id bn8mr27133620ejb.445.1617006922940; Mon, 29 Mar 2021 01:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006922; cv=none; d=google.com; s=arc-20160816; b=UuQ90cjqdS4cbc0OvdZ1YKEWc0tvIvFj7VsL29Y1tQDlIXTAg4bHkub4SiolWZiUDR nw3/ptSJD/VlH6nvrdi18sd5qy9UQi+AdCWZUYNu+Oej5Dk2t4Ehl5+zd/613Q4dt/eM BlqH/vu2jvb8cBdCz0RBor/Lz1Dxm0GGgAzHEnWDc10QHYHE5xtclYiTOG6FUISQd0P7 /AIAtgp3jItdwU5lHyMFJDRxc0zK9CLz6/VKIIGymUa7aMD7Klu+E1mZu0PSWvXjDhai 1pTeSYgdSwXp1R0kbOShzgK+kbsBW4b8uSPOxw+CgLQhoyKktCVDaBDhjYZ8iXvg+6BL 7QSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Ppu5rzBZXS3QkQyVKTij12ZN8zkicHI7s91BKSTFWo=; b=yM739fNL1r+f7DSiRzFVMlFsH/edvmqMigC0vaBuPieHLnNQEdCaeJXLF13lpppRiC t+EE14YJ7OwiF8mSv/majO4fDCuMGBtFjZRI7SgXQODOpM1wIua1mcO2yaeigmf75Pti AvNxt1c0JCHh5+yc5CFA1OMDmcjb4FZLDNcDysN2Iwr1NC1iTXdF34Atv4zX2oSZw491 Jgq7LqH2eFchBU7TAVGRlrc2Z9jdcqY5ikhYwCvSmhjRMp6BDPK5ro/0Gxoum6Fa07vP yBy+c5l1oejeqmiUTO7vYPwnaok6DGN+h+r6IavbBNV/UvEdCuVLyWnghv95DOIxRBMi /9Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zBm74T0S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si12502880ejb.453.2021.03.29.01.35.00; Mon, 29 Mar 2021 01:35:22 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=zBm74T0S; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233349AbhC2IeC (ORCPT + 99 others); Mon, 29 Mar 2021 04:34:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:38318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbhC2IVO (ORCPT ); Mon, 29 Mar 2021 04:21:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15DD261878; Mon, 29 Mar 2021 08:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006073; bh=NC9t+9wh29BL2UOrEUB8oxVUgip+FIWRFY7+qyWQ218=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zBm74T0SeGnkv/jnZgp6L6WLnr1Gyfzn2UpUFxTQG3gI6sWyIZ1yNUnsRhuKjQfi/ b0749q0igTdzzwoqi4TEy8FJ0XTFL328IenKILO3V3o44skrxVLOPAi9xXDFGxt364 CEnljNElfJYYtdMGcsk8WcS6XzFBSKPBsuSuVUDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Vitaly Lifshits , Dvora Fuxbrumer , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 109/221] e1000e: add rtnl_lock() to e1000_reset_task Date: Mon, 29 Mar 2021 09:57:20 +0200 Message-Id: <20210329075632.847862111@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vitaly Lifshits [ Upstream commit 21f857f0321d0d0ea9b1a758bd55dc63d1cb2437 ] A possible race condition was found in e1000_reset_task, after discovering a similar issue in igb driver via commit 024a8168b749 ("igb: reinit_locked() should be called with rtnl_lock"). Added rtnl_lock() and rtnl_unlock() to avoid this. Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)") Suggested-by: Jakub Kicinski Signed-off-by: Vitaly Lifshits Tested-by: Dvora Fuxbrumer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e9b82c209c2d..a0948002ddf8 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -5974,15 +5974,19 @@ static void e1000_reset_task(struct work_struct *work) struct e1000_adapter *adapter; adapter = container_of(work, struct e1000_adapter, reset_task); + rtnl_lock(); /* don't run the task if already down */ - if (test_bit(__E1000_DOWN, &adapter->state)) + if (test_bit(__E1000_DOWN, &adapter->state)) { + rtnl_unlock(); return; + } if (!(adapter->flags & FLAG_RESTART_NOW)) { e1000e_dump(adapter); e_err("Reset adapter unexpectedly\n"); } e1000e_reinit_locked(adapter); + rtnl_unlock(); } /** -- 2.30.1