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 DF119478E3E; Tue, 16 Jun 2026 18:21:39 +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=1781634101; cv=none; b=IJtRUWup7FJYig7GOyTrXasDY/TUfINdPYfeghMV7BHAMNjLC7mCazA7auX2YjwhvoXqxtL9qyGyL4ilzSyEppASHLjCIVX1TWV2T9FNeGQyDiERh9ZxVCG/WVf9abNA80qXZZdlONwsPz5rfVzh3DsC8Rhk+gi3iSuoFHKcxfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634101; c=relaxed/simple; bh=EMrPMx+/Uqh1qd1t306NDT88Kfq5Vdmpk4g6vKWka9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SZTOanD3Z8KSZZ2DWMUoqVVQHAZ/jFiWvhRjldpJfypEJDp816scr87cm/ElZJQ/sBWX3LygcdL4HSIhbplZhIseBOsZpZqepO0KW/ufLbzBijPjBNEHyODpaFuWk913wB6ebzyYvR24mZUuyCRaqIPCyo1gH/qmPLB16HHOKnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kfAMwIrQ; 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="kfAMwIrQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E613B1F000E9; Tue, 16 Jun 2026 18:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634099; bh=Yoe+kIhY8NS/fdv4lPp6OhMRwRi1P1gt707ezv/1HbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kfAMwIrQkjfqkX4eqDOxdyfMqDa/n2LIZ8oQ7FpA4rEbwsVYtGF5kw2Hw/X/C0urP B0nRLVkUfjy83Ck1QUhXb24EruRXHNLVDY43XE0tc253zqV9o7IFCEtDIiQNkDAace OqQEjwmfddAKi6ll1nnvkr97R7YnPpVpqJ7qTr78= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Lunn , Oscar Maes , Alexander Lobakin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 159/411] pcnet32: stop holding device spin lock during napi_complete_done Date: Tue, 16 Jun 2026 20:26:37 +0530 Message-ID: <20260616145108.940199509@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oscar Maes [ Upstream commit 73bf3cca7de6a73f53b6a52dc3b1c82ae5667a4d ] napi_complete_done may call gro_flush_normal (though not currently, as GRO is unsupported at the moment), which may result in packet TX. This will eventually result in calling pcnet32_start_xmit - resulting in a deadlock while trying to re-acquire the already locked spin lock. It is safe to split the spinlock block into two, because the hardware registers are still protected from concurrent access, and the two blocks perform unrelated operations that don't need to happen atomically. Fixes: 5b2ec6f2be51 ("pcnet32: use napi_complete_done()") Reviewed-by: Andrew Lunn Signed-off-by: Oscar Maes Reviewed-by: Alexander Lobakin Link: https://patch.msgid.link/20260528140320.5556-1-oscmaes92@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/amd/pcnet32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 70d76fdb9f569d..58a59b2d70cf2b 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -1399,8 +1399,10 @@ static int pcnet32_poll(struct napi_struct *napi, int budget) pcnet32_restart(dev, CSR0_START); netif_wake_queue(dev); } + spin_unlock_irqrestore(&lp->lock, flags); if (work_done < budget && napi_complete_done(napi, work_done)) { + spin_lock_irqsave(&lp->lock, flags); /* clear interrupt masks */ val = lp->a->read_csr(ioaddr, CSR3); val &= 0x00ff; @@ -1408,9 +1410,9 @@ static int pcnet32_poll(struct napi_struct *napi, int budget) /* Set interrupt enable. */ lp->a->write_csr(ioaddr, CSR0, CSR0_INTEN); + spin_unlock_irqrestore(&lp->lock, flags); } - spin_unlock_irqrestore(&lp->lock, flags); return work_done; } -- 2.53.0