From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.175 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== 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== 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 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 ; Thu, 3 Dec 2026 06:14:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 013FE606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=telaak.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-93f2f2edb19so1155007285a.0 for ; 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+BG74pzPuugwP1W3RDCoHY0sORHGNm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939:fde0:a71b with SMTP id af79cd13be357-949ba6c4bf4mr7707081685a.0.1796278468084; Wed, 02 Dec 2026 22:14:28 -0800 (PST) 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) From: Joseph Telaak Date: Thu, 03 Dec 2026 01:14:24 -0500 Subject: [PATCH iwl-net] e1000: always cancel the reset task in e1000_remove() X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-e1000-remove-reset-task-v1-1-71d6e9464dc5@telaak.dev> X-B4-Tracking: v=1; b=H4sIAAAAAAAA/yWM2wrCMBBEf6XsswtJwBL8FfGhptO6XlLJplUo/ XdXfZnhMMxZSVEESodmpYJFVKZs4HcNpUuXR7D0xhRcaL0FwzvnuOAxLbBSVK6d3ngIKfZx72M Mgez9LBjk/TMfSV53zqh0+g86n69I9eulbfsADmTBp4QAAAA= X-Change-ID: 20261202-e1000-remove-reset-task-f2c8d8518822 To: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stanislav Fomichev , Joe Damato , Jacob Keller Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Joseph Telaak X-Mailer: b4 0.16.0 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 --- 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