[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbcdbc1b-44bc-4cf8-86ef-6e6af2b009c3@gmail.com>
Date: Fri, 5 Apr 2024 22:29:15 +0200
From: Heiner Kallweit <hkallweit1@...il.com>
To: Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>, David Miller <davem@...emloft.net>,
Realtek linux nic maintainers <nic_swsd@...ltek.com>
Cc: Lukas Wunner <lukas@...ner.de>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH net] r8169: fix LED-related deadlock on module removal
Binding devm_led_classdev_register() to the netdev is problematic
because on module removal we get a RTNL-related deadlock. Fix this
by using the parent device instead for device-managed resources.
This is cleaner anyway because then all device-managed resources in
the driver use the same device (the one belonging to the PCI device).
Fixes: 18764b883e15 ("r8169: add support for LED's on RTL8168/RTL8101")
Cc: stable@...r.kernel.org
Reported-by: Lukas Wunner <lukas@...ner.de>
Suggested-by: Lukas Wunner <lukas@...ner.de>
Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
---
drivers/net/ethernet/realtek/r8169_leds.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169_leds.c b/drivers/net/ethernet/realtek/r8169_leds.c
index 7c5dc9d0d..7f2b8a361 100644
--- a/drivers/net/ethernet/realtek/r8169_leds.c
+++ b/drivers/net/ethernet/realtek/r8169_leds.c
@@ -146,13 +146,12 @@ static void rtl8168_setup_ldev(struct r8169_led_classdev *ldev,
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
- devm_led_classdev_register(&ndev->dev, led_cdev);
+ devm_led_classdev_register(ndev->dev.parent, led_cdev);
}
void rtl8168_init_leds(struct net_device *ndev)
{
- /* bind resource mgmt to netdev */
- struct device *dev = &ndev->dev;
+ struct device *dev = ndev->dev.parent;
struct r8169_led_classdev *leds;
int i;
@@ -245,13 +244,12 @@ static void rtl8125_setup_led_ldev(struct r8169_led_classdev *ldev,
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
- devm_led_classdev_register(&ndev->dev, led_cdev);
+ devm_led_classdev_register(ndev->dev.parent, led_cdev);
}
void rtl8125_init_leds(struct net_device *ndev)
{
- /* bind resource mgmt to netdev */
- struct device *dev = &ndev->dev;
+ struct device *dev = ndev->dev.parent;
struct r8169_led_classdev *leds;
int i;
--
2.44.0
Powered by blists - more mailing lists