From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 99EB62EE991; Tue, 22 Jul 2025 14:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753193523; cv=none; b=a1Bb72+aHcts90GzA8uZxktdAGON8jfYWSo0zeF0J5SQmwOLxTNMxKaNMpwpiHcrRVkNjBUCLa388HrpkfPERzNmAwvYT1Y43gPG7yzNhekfECR/LDQ3MlNyMUtNW5PIPHoy3XqFL39OTSPNUDBYtjPgbqgUd04pEv2KA3pwB6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753193523; c=relaxed/simple; bh=VuA8k2q7pVIQ4AcETZW0DjtA22vfbBaCuW3r94x5EJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dC5oPfos3eCH+wfBbYm3eFKhFK5sP/guansrNLhbD1eGdOdAjuEfqJuB21d6pFRGidmqk+RkHl4/ErQu6sEprPbQ4NhyUnfDrTcDu0AdUGW/WG1nEOT9qRKbfSm30CVVA8Eksc0vFMfaSDrQ/cuAPEm/Tf8vA6fmYnbK8aRglZ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JHwnQoQN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JHwnQoQN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22490C4CEF5; Tue, 22 Jul 2025 14:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753193523; bh=VuA8k2q7pVIQ4AcETZW0DjtA22vfbBaCuW3r94x5EJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHwnQoQNOd2p5K1i3KqiYVJsfsibov5p5GVZWDPpXeeYFhQUnbpemc2tm0mfdL3lD XHh6O91G+rpQKGEG9oBmoIXm6sHUvGWqTtEFPtJGI9aUDKE4XpClYbLYAMvp7YC5EK /d7Bu2Q5IM1tMhM3K+E/X3YWhxc6naAU7RAD+Xa8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sean Anderson , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.15 119/187] net: phy: Dont register LEDs for genphy Date: Tue, 22 Jul 2025 15:44:49 +0200 Message-ID: <20250722134350.190807574@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250722134345.761035548@linuxfoundation.org> References: <20250722134345.761035548@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Anderson [ Upstream commit f0f2b992d8185a0366be951685e08643aae17d6d ] If a PHY has no driver, the genphy driver is probed/removed directly in phy_attach/detach. If the PHY's ofnode has an "leds" subnode, then the LEDs will be (un)registered when probing/removing the genphy driver. This could occur if the leds are for a non-generic driver that isn't loaded for whatever reason. Synchronously removing the PHY device in phy_detach leads to the following deadlock: rtnl_lock() ndo_close() ... phy_detach() phy_remove() phy_leds_unregister() led_classdev_unregister() led_trigger_set() netdev_trigger_deactivate() unregister_netdevice_notifier() rtnl_lock() There is a corresponding deadlock on the open/register side of things (and that one is reported by lockdep), but it requires a race while this one is deterministic. Generic PHYs do not support LEDs anyway, so don't bother registering them. Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs") Signed-off-by: Sean Anderson Link: https://patch.msgid.link/20250707195803.666097-1-sean.anderson@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/phy/phy_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 7d5e76a3db0e9..2f5bb4d0911d2 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3391,7 +3391,8 @@ static int phy_probe(struct device *dev) /* Get the LEDs from the device tree, and instantiate standard * LEDs for them. */ - if (IS_ENABLED(CONFIG_PHYLIB_LEDS)) + if (IS_ENABLED(CONFIG_PHYLIB_LEDS) && !phy_driver_is_genphy(phydev) && + !phy_driver_is_genphy_10g(phydev)) err = of_phy_leds(phydev); out: @@ -3408,7 +3409,8 @@ static int phy_remove(struct device *dev) cancel_delayed_work_sync(&phydev->state_queue); - if (IS_ENABLED(CONFIG_PHYLIB_LEDS)) + if (IS_ENABLED(CONFIG_PHYLIB_LEDS) && !phy_driver_is_genphy(phydev) && + !phy_driver_is_genphy_10g(phydev)) phy_leds_unregister(phydev); phydev->state = PHY_DOWN; -- 2.39.5