🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26172

[PATCH iwl-net] e1000: always cancel the reset task in e1000_remove()

#26172
From: Joseph Telaak
Date: Thu, 03 Dec 2026 06:14
60 lines
12308 bytes
e1000_remove() skips cancel_work_sync() on the reset task while
__E1000_RESETTING is set. The check was needed when the cancel was in
e1000_down_and_stop(), which the reset task reaches through
e1000_down(), and it stayed when commit b4a8085ceefb ("e1000: Move
cancel_work_sync to avoid deadlock") moved the cancel after
unregister_netdev() in e1000_remove().

Every other path that sets __E1000_RESETTING runs under RTNL on the
registered netdev, so after unregister_netdev() only the reset task can
hold it. The check therefore skips the cancel while the task holds the
bit, and free_netdev() can free the adapter before the task clears it.
With __E1000_DOWN already set the task holds the bit only briefly, so
this needs the task to be preempted there.

e1000_remove() does not hold RTNL there, so cancelling the task, which
takes RTNL, cannot deadlock. e1000e also cancels its reset task
unconditionally in its remove path.

Fixes: b4a8085ceefb ("e1000: Move cancel_work_sync to avoid deadlock")
Signed-off-by: Joseph Telaak <joseph@telaak.dev>
---
Sashiko pointed this out while reviewing an unrelated e1000 series:
https://lore.kernel.org/r/sashiko-outbox-245054@kernel.org
I know of no field reports, and I could only hit the window with the
test hooks below.

Tested on a CE5300 board with KASAN and lockdep, using test-only hooks
that queue the reset task in e1000_remove() and hold __E1000_RESETTING
in it for a second. Without this patch KASAN reports a slab
use-after-free in e1000_reinit_locked() from the reset task, with the
netdev freed by e1000_remove(). With it, e1000_remove() waits for the
task, and unbind and rebind work with no reports.
---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index a52fff0259a1..d79e7ca69792 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -1270,9 +1270,7 @@ static void e1000_remove(struct pci_dev *pdev)
 
 	unregister_netdev(netdev);
 
-	/* Only kill reset task if adapter is not resetting */
-	if (!test_bit(__E1000_RESETTING, &adapter->flags))
-		cancel_work_sync(&adapter->reset_task);
+	cancel_work_sync(&adapter->reset_task);
 
 	e1000_phy_hw_reset(hw);
 

---
base-commit: 68be40d53028e490d37ff7e754dac4afae2ef421
change-id: 20261202-e1000-remove-reset-task-f2c8d8518822

Best regards,
--  
Joseph Telaak <joseph@telaak.dev>
Technical Details
Message-ID: <20261203-e1000-remove-reset-task-v1-1-71d6e9464dc5@telaak.dev>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376322-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376322-linux-kernel-netdev=dewy.ru
From: joseph@telaak.dev (Joseph Telaak)
Newsgroups: linux.kernel.netdev
Subject: [PATCH iwl-net] e1000: always cancel the reset task in
 e1000_remove()
Date: Thu, 03 Dec 2026 01:14:24 -0500
Organization: Usenet Network
Message-ID: <20261203-e1000-remove-reset-task-v1-1-71d6e9464dc5@telaak.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2193327"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Dqwm/4ppO3z6Q1en+LJu+V4DCog= sha256:8QiQnYG9CrX5foZpESbtPYqJRZIl9kZfRB9keirjMbE=
	sha1:+4AZL3BszwAs8NWdopbzwhl1TTE= sha256:2TbnamdlFpgsjg6GW5TiHwf/XBNSd62w1BHfW8ghl9A=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id EA1ED117836; Thu,  3 Dec 2026 09:14:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 1S5DTfP2hnuJ;
	Thu,  3 Dec 2026 09:14:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376322-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=telaak.dev
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 6669211782E; Thu,  3 Dec 2026 09:14:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 62A2B27B08; Thu,  3 Dec 2026 06:14:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796278470;
	b=qLcVGQivMzOWI3ED3Ls6AOLeQlQzm8CacL2ItpMoPiDNLey2GRFGoj4ZabO2+Oop7Ljv
	 RTAhCi/mRgxyQTQ/v/1CXf91ZVnnsO+KbMnvtVbnAjuWrpckuX306XGnYiO/9r88yI5NS
	 zRIdmRQvIGIxJsIGjjHnayW2CmXTxXsTGUNOVncSro+GmHa4bUc2OfZvpbzUhMRYv7NvQ
	 AnJsEImDQt4VOt+o7HkddECaxBhBgFWxh4S1d+6lmkXS0htiXvKQA/0rUfhHSeu5+ohBG
	 DQhGmC806FXIKYscijHIlTTY13p43d9JoX5x9knIWLyzOXFOmZLziZQAWHDLQPiL2JA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796278470;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking:
	 X-Change-ID:To:Cc:X-Mailer;
	bh=x5Jwngk9fJHCUvdXJrzUDZR8ljrFiSFMEQ/qU4NWAj8=;
	b=yhroNYu3CLMaVH726LLijd7d8777QRdPJqRR1PZSwsmef9ZLGGK9Ijq4mhhl+enuXaUX
	 KTZnb2HWWg+ReKT/rg8USb5ZiZzC0f1bVE6vtbOp9RYQ/5ga843H7nEsbNOx8+t4wU1Ol
	 Fs8kTnyY2y/vLWlM35ZKJ/ISAIwMg8ZRHb+AMuXZmtrSFdkKGkxips139h1ma0NyJKoLn
	 RAcsljDOvaSlf7L9tDsUWfMz59JWldeX3T6BIBjxv3zF1IsDP2kDbXThrxyRYAV3hFMYU
	 K1rxkvoAI6pu9lbUIwdvN4Y4Um9kx1KqGodqNTDH7BGs58zfyMfZ9yuP1tbZe9ONNqQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=telaak.dev;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EBEBF606A333;
	Thu,  3 Dec 2026 06:14:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796278469;
	b=RTBWYY1Nj51H/mo0FLZLGdpQZmudeqGnQWxnemryiYtDzKrxZ4DTuV/lgFb3qE8sxiRb
	 8CJs6vcDs2ckuqrbd1nw+w5j/x8ykZzEXqYHVsEWmGblrOkpa7b2bnY3Lhf4zI63EtHZh
	 YJ0XoB4tlzhbkyfqKXcMewK4SMN6DxqR4zdXjG8kvIAvkbtnF9OZBceGCkwqXBsO45Z4s
	 6/JSUvottFCVM7QEPkoVd7m/AhcWHrxWOWI0bnU0XzAg6ZBIsUl+u3B9DPnMZo1hOq7ME
	 nfaRh6lk47DMd4XhJfLTmL2OLX588Dp3O/rBG+CzsSSYmhmgqrfjjRfm5E84U3zVLVA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796278469;
	h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:Date:Subject:
	 MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:
	 X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer;
	bh=x5Jwngk9fJHCUvdXJrzUDZR8ljrFiSFMEQ/qU4NWAj8=;
	b=JMUfmQzNuIsSh9Z+dA8CikbLtLxC4s5ezKWRcv3emRGvjmnZdtosMResEZqdAPEAcG+6
	 Wb2NQSLehdl5/hwpKIVGUqVX4hFMaiFUEW+PfkFHrzNgNW1Ef3zWQe/1S6ATj2hi6AWA7
	 b4gw3tYXe5O1+zjUTq9LThL8dwQLaeYP3tIEqMgB494S5hp1bzA5ODXh6zuYvitJHxT+W
	 iaFDzQ45Kqhi3fHA3+stAfnhhIlNht7asAe3y1DqhE6/hWxLd2s+SYqIrwbloaFsBT6ey
	 M8AifWSlHvsW6v1DEvEtuM1VvGLCz36TSUjc54SfGXJwqIITKecJW1T3Nipq/C3mLsQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=telaak.dev;
	spf=pass smtp.mailfrom=gmail.com;
	arc=none smtp.remote-ip=209.85.222.175
X-Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 013FE606A322
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 06:14:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 013FE606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=telaak.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-93f2f2edb19so1155007285a.0
        for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 22:14:28 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796278468; x=1796883268;
        h=cc:to:message-id:content-transfer-encoding:content-type
         :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to
         :cc:subject:date:message-id:reply-to:content-type;
        bh=x5Jwngk9fJHCUvdXJrzUDZR8ljrFiSFMEQ/qU4NWAj8=;
        b=ys0zn9M8qGNV3a/5mCcoW+4mXkv52BnlwSSAGRdhxLhp1Xm6B4vYFldXXXC/GzLjhb
         jNYVkzi+/t4kK4JjPuxwgoY2yXVF0Py1KmDyxDyIEL/mmUm2HkXjtIqGfTFAdHFkA9BS
         3P2Ftb2YoSAznC1FSumyWQFlhUJ4lROmWIlP2Scx2Q5x/+s63kHvpQNGVcDcyM2X5940
         vlxOkYsJYe3kaPX6Mt3NyCioIX4A9alfXxC//v4IDvsNy0+7+BYt7FY5aQehw/JvrT+A
         6fxyoiUL+BG74pzPuugwP1W3RDCoHY0sORHGNm0N+RgVL0rWbk1TdYsF2NFPmGPnKpGI
         k6xg==
X-Forwarded-Encrypted: i=1; AL+hErHFjdtbhAo0JgJOUTgMZM0I13AOb9maGv1vDUlwFAuxfEf9aU6g+Gd6giMqq8G8Fb1Vj5wqWCY=@vger.kernel.org
X-Gm-Message-State: APuU4Z9izp9L9qmn2oYuQmhkL7otloPOTonPbJHSbg5DhMykEZWuke8v
	8lySufuXmsNgyf2Nwq8K324LEkJ8nKjBfyz19Fuw9FHFUeyaSmgKi2Hv
X-Gm-Gg: AZFdTZdkb3yJGIRmoyIYyldHbXW3tjc5GjW+nPg5mhs3YmA+p/YqyV7VTWhi07vpRSh
	5c+kpYwvTS8lldiQbZ/6vkQ++S9MSh7TvTQZulwWoI7PDshIiL2Aonyi0Dmltn64osywcwRskBg
	pWf0fqLa3f4TDewuz9bjRsKzpRk4KlUq8EJEidI+L4P3pnpnv4URjTrLsvRdq75REb4eSa7VQld
	92u3SHJ0svwRuLo0sub9662Ms6IrHKpPi/zq8hvE+82oPQyL0XNTqB7JQAVfO80Spn9K7/Xi46C
	7xyE0h6cIx2LmlPWvDBlEIO+4lIvaAnWo02MzW14TyVzJkNnhWWnFBId5gGR+eXz7DNRs1ovxrw
	VzMfyrm2SVAMxPnLQ4VtAQ7V/fba1YNav/G+HJ9QibzJk3wHkUCRgP0GgseMP4yCS/GlASGQk3l
	P7opFmBtddzkG8KEqN6Es0vBbA18z/EC0SrLF+AwxZl30QKYF6ysC1C7ufs9A3EgqMoaspb5mnB
	6PZ72BB0qKrkLMPTtLP/zm2iPUtV8G1Em889SaXHQ3x02RBKIpkcPuEb06jM2LuZQCfUkQdoivp
	joeIkx1FfKE1X3J/2OSKyUWk5QT97I3fPI2rnL/F2Y1V1WnOlr0933Qd+Am7h5Ac4Rwa9eyRHs+
	4l10LVn/CstsJGJCEoXYH5+LQSiK5CuERRTs9AGyeKYTKetRhC3t2wc6f+2BqcM0HJh4mwczu5y
	QhugaZfBUJ98aHmjPc286Co7Ma
X-Received: by 2002:a05:620a:6484:b0:939:fde0:a71b with SMTP id af79cd13be357-949ba6c4bf4mr7707081685a.0.1796278468084;
        Wed, 02 Dec 2026 22:14:28 -0800 (PST)
X-Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa ([71.68.170.161])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-9217efd0637sm213187116d6.42.2026.12.02.22.14.27
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 02 Dec 2026 22:14:27 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-B4-Tracking: v=1; b=H4sIAAAAAAAA/yWM2wrCMBBEf6XsswtJwBL8FfGhptO6XlLJplUo/
 XdXfZnhMMxZSVEESodmpYJFVKZs4HcNpUuXR7D0xhRcaL0FwzvnuOAxLbBSVK6d3ngIKfZx72M
 Mgez9LBjk/TMfSV53zqh0+g86n69I9eulbfsADmTBp4QAAAA=
X-Change-ID: 20261202-e1000-remove-reset-task-f2c8d8518822
X-Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, 
 Joseph Telaak <joseph@telaak.dev>
X-Mailer: b4 0.16.0