From patchwork Tue Jan 21 14:05:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 13946314 X-Patchwork-Delegate: kuba@kernel.org Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) (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 DE8C61F3D20; Tue, 21 Jan 2025 14:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.143.211.150 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737468364; cv=none; b=jaHfxOLkHNQ8IPov+yXc7Z5QhX+PqUiijJorlLa4M23GYCu8w/DBWg4431Bw8YZNNN9DHzgSXWmzNJrfkHM3Xpz+gI9DCtAW/PB1yZdtfhIdzCq6iCUJ5C9qtI36WkREXddBgmKouaLNBHlc+kMtq6ROF/kvL9Nc4Qr9jw+JpyQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737468364; c=relaxed/simple; bh=Xpa7IX0n70Om8l3j5/WWMYX3ri6JfsIVsc7fH7WNX2k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eaKPwPjgdq8Y8Q4QsmuLPFEFoCZpYJyWQ5qYawtQJ7w9WaxeghPRTqV6gXRRfQU7ue3gA8Hu8Jyw9AyCZlfEd+1garr3DvPk7hdFGOg8LLPDel0eYtOwLN+doZ5I0uJwx8PEOjJuPPh7ITRwrlPbkEmAnsZsU1kYuq4JgU0aLDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru; spf=pass smtp.mailfrom=swemel.ru; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b=mNks2lzy; arc=none smtp.client-ip=95.143.211.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=swemel.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=swemel.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=swemel.ru header.i=@swemel.ru header.b="mNks2lzy" From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1737468356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8hooSNZ5KGXNJj+d5pzIQGkZP6GM4aexIpPVsywTiDk=; b=mNks2lzyfk+cu8RrNPoepAQm4WdDcpfxCXPsRLoOFlElXTOHJGjpm63NynndUaNS2MR6Ho JktYOTziBqc6y/hXvGLec6KpkguopqnYMegepfF7DvwRw6RXUmH2no3Ent7zMudXJS0L70 6oA1mM8y/3Cki8ceg2LtVobEq0uSsYw= To: stable@vger.kernel.org, Greg Kroah-Hartman Cc: Fugang Duan , "David S. Miller" , Jakub Kicinski , Xiao Jiang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Wei Fang Subject: [PATCH 5.10] net: fec: remove .ndo_poll_controller to avoid deadlocks Date: Tue, 21 Jan 2025 17:05:53 +0300 Message-ID: <20250121140555.28188-1-arefev@swemel.ru> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Wei Fang commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 upstream. There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic context and disable_irq() is called by .ndo_poll_controller interface of sungem driver, however, disable_irq() might sleep. After analyzing the implementation of fec_poll_controller(), the fec driver should have the same issue. Due to the fec driver uses NAPI for TX completions, the .ndo_poll_controller is unnecessary to be implemented in the fec driver, so fec_poll_controller() can be safely removed. Fixes: 7f5c6addcdc0 ("net/fec: add poll controller function for fec nic") Signed-off-by: Wei Fang Link: https://lore.kernel.org/r/20240511062009.652918-1-wei.fang@nxp.com Signed-off-by: Jakub Kicinski [Denis: minor fix to resolve merge conflict.] Signed-off-by: Denis Arefev --- Backport fix for CVE-2024-38553 Link: https://nvd.nist.gov/vuln/detail/cve-2024-38553 --- drivers/net/ethernet/freescale/fec_main.c | 26 ----------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index a591ca0b3778..815062c23708 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3226,29 +3226,6 @@ fec_set_mac_address(struct net_device *ndev, void *p) return 0; } -#ifdef CONFIG_NET_POLL_CONTROLLER -/** - * fec_poll_controller - FEC Poll controller function - * @dev: The FEC network adapter - * - * Polled functionality used by netconsole and others in non interrupt mode - * - */ -static void fec_poll_controller(struct net_device *dev) -{ - int i; - struct fec_enet_private *fep = netdev_priv(dev); - - for (i = 0; i < FEC_IRQ_NUM; i++) { - if (fep->irq[i] > 0) { - disable_irq(fep->irq[i]); - fec_enet_interrupt(fep->irq[i], dev); - enable_irq(fep->irq[i]); - } - } -} -#endif - static inline void fec_enet_set_netdev_features(struct net_device *netdev, netdev_features_t features) { @@ -3322,9 +3299,6 @@ static const struct net_device_ops fec_netdev_ops = { .ndo_tx_timeout = fec_timeout, .ndo_set_mac_address = fec_set_mac_address, .ndo_do_ioctl = fec_enet_ioctl, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = fec_poll_controller, -#endif .ndo_set_features = fec_set_features, };