From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEB01393DF3; Thu, 17 Sep 2026 18:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668014; cv=none; b=A4uQH+r6L9eii0SZHvttGdq1B5tpM8rjGVdkohtkBspqJeHzbPNcmoxrD+NFnqfgeocXScgXrxXPJwn/1jfklZhUAy5nwHwCsEPSuI2jzVMt+myFz941QXZ8/6Vl09GGUGXopBoKoVvhco8rrALNTtb7JmnPVurbBUunl+s5+vs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668014; c=relaxed/simple; bh=duU6IgLMOzausTHL7XnacqZk3z7lZX/rDoqrP7stFNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bgDDmL7NJmCjnugwPVCsKQyRnjBjqYUs1M06TJdSEGr9b5ZcM4jOs7pYfM83/Ap2UToQOD9WODgmixhAvLFbwa7AQVEAYGEtewBd6sNsDorkvP0hxgUdoQpqsE1yKF8ZAlOVCnso4E7W8RWXZFcnAY4kLwrOZwaAztqgOYM1dFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=P/LQvsVY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="P/LQvsVY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32ADA1F000FF; Thu, 17 Sep 2026 18:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789668012; bh=/iJCOYa9riN8gLSBvelDKAfxMqfeJ6xgSSeXQZbncLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P/LQvsVYcLyy/ra9/YAW2uqnmRTQV+cQxIwmRuajPdB2upxF5avFKTyweb/7ELfCL YndlO9hlkxxN3ft2cv0rWX7uDF/h7UzyKNbbNL3z8h1VEiT3zO7aAStBSsaKF+sCKY dHSr2wP7Lp9eCKfjVss/JOUa8Bzv2ExMZDTPMj/A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rosen Penev , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 0252/1102] net: ibm: emac: mal: fix potential system hang in mal_remove() Date: Thu, 17 Sep 2026 16:03:15 +0100 Message-ID: <20260917151545.921543711@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rosen Penev [ Upstream commit 7c5d41f87f079990bf241359e3c1332d8d10fe87 ] napi_disable() is not idempotent and calling it on an already-disabled or unenabled NAPI context will cause the kernel to spin indefinitely waiting for the NAPI_STATE_SCHED bit to clear. In mal_remove(), napi_disable() is called unconditionally. If no MACs were registered, NAPI was never enabled. Also, if they were registered but subsequently unregistered, NAPI was already disabled in mal_unregister_commac(). In either case, calling napi_disable() causes the kernel to hang upon module removal. Fix this by only calling napi_disable() in mal_remove() if the commac list is not empty (which implies NAPI is enabled). Signed-off-by: Rosen Penev Link: https://patch.msgid.link/20260603230821.5619-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/ibm/emac/mal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 99d5f83f7c60b..4d1f2292798c0 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -724,13 +724,13 @@ static void mal_remove(struct platform_device *ofdev) MAL_DBG(mal, "remove" NL); /* Synchronize with scheduled polling */ - napi_disable(&mal->napi); - - if (!list_empty(&mal->list)) + if (!list_empty(&mal->list)) { + napi_disable(&mal->napi); /* This is *very* bad */ WARN(1, KERN_EMERG "mal%d: commac list is not empty on remove!\n", mal->index); + } free_irq(mal->serr_irq, mal); free_irq(mal->txde_irq, mal); -- 2.53.0