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 7C5D0A32; Tue, 22 Jul 2025 14:02:09 +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=1753192929; cv=none; b=LLM02zLvaMdAufJC4dF7Sv8tKEft34aX9QY03ipE+8I88yiL6ZTYNSzRbjJ2pF8SAXMNEklAxrBDbRRjBLz8mZxHulycEMs9rot4pA2on81VPIdALb0Tt8KJERUkw9efROB/9HkdPoAy3VIwS4G+cclxWqFvJce+5sku2MMQVFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753192929; c=relaxed/simple; bh=h1QMUQ784L03HtdOSHYimMybxvJqC5AXLT17wX9Duv0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XzL5Ja/Px7GXT0oJEUr8ESnn/vrUNJcgfouInnFkMdP4b89BpeSACD1vdi1vJ8bGMpzJ7ydbvNpwSPTy1aOSOAJRfhqzpjLcus76M/n/Jcq+s1jlXRVFUBI6sge/YYv/H0cXzJa0iifprpW6Z2Zai+KviwHYUfKKMlVHVG4SoQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F3U5CIV+; 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="F3U5CIV+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD878C4CEEB; Tue, 22 Jul 2025 14:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753192929; bh=h1QMUQ784L03HtdOSHYimMybxvJqC5AXLT17wX9Duv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3U5CIV+GAj37pDHke69Zygi1PqDeHj9lbz9NJMUPGCUB8KXtLzuKGT2ZDd7aINrX s20lKy9hVHnHMe1A6+OszU8gZj/t2dobQApz0yilRGBXW0LGJ0drpZ/VtyPXrkGaL4 wwoweTYsjWCJK/hEUsNI9lw7ucubz4MOJuK0anow= 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.12 099/158] net: phy: Dont register LEDs for genphy Date: Tue, 22 Jul 2025 15:44:43 +0200 Message-ID: <20250722134344.446427884@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250722134340.596340262@linuxfoundation.org> References: <20250722134340.596340262@linuxfoundation.org> User-Agent: quilt/0.68 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: 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 13dea33d86ffa..834624a61060e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3663,7 +3663,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: @@ -3680,7 +3681,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