public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: pse-pd: Fix deadlock in current limit functions
@ 2025-02-12 15:17 Kory Maincent
  2025-02-13 18:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Kory Maincent @ 2025-02-12 15:17 UTC (permalink / raw)
  To: Kory Maincent, Paolo Abeni, Oleksij Rempel, netdev, linux-kernel
  Cc: thomas.petazzoni, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski

Fix a deadlock in pse_pi_get_current_limit and pse_pi_set_current_limit
caused by consecutive mutex_lock calls. One in the function itself and
another in pse_pi_get_voltage.

Resolve the issue by using the unlocked version of pse_pi_get_voltage
instead.

Fixes: e0a5e2bba38a ("net: pse-pd: Use power limit at driver side instead of current limit")
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---

It seems the current limit configuration was not tested in the last
patch series. Sorry for that.
---
 drivers/net/pse-pd/pse_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
index 4f2a54afc4d0..4602e26eb8c8 100644
--- a/drivers/net/pse-pd/pse_core.c
+++ b/drivers/net/pse-pd/pse_core.c
@@ -319,7 +319,7 @@ static int pse_pi_get_current_limit(struct regulator_dev *rdev)
 		goto out;
 	mW = ret;
 
-	ret = pse_pi_get_voltage(rdev);
+	ret = _pse_pi_get_voltage(rdev);
 	if (!ret) {
 		dev_err(pcdev->dev, "Voltage null\n");
 		ret = -ERANGE;
@@ -356,7 +356,7 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA,
 
 	id = rdev_get_id(rdev);
 	mutex_lock(&pcdev->lock);
-	ret = pse_pi_get_voltage(rdev);
+	ret = _pse_pi_get_voltage(rdev);
 	if (!ret) {
 		dev_err(pcdev->dev, "Voltage null\n");
 		ret = -ERANGE;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: pse-pd: Fix deadlock in current limit functions
  2025-02-12 15:17 [PATCH net] net: pse-pd: Fix deadlock in current limit functions Kory Maincent
@ 2025-02-13 18:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-13 18:10 UTC (permalink / raw)
  To: Kory Maincent
  Cc: pabeni, o.rempel, netdev, linux-kernel, thomas.petazzoni,
	andrew+netdev, davem, edumazet, kuba

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 12 Feb 2025 16:17:51 +0100 you wrote:
> Fix a deadlock in pse_pi_get_current_limit and pse_pi_set_current_limit
> caused by consecutive mutex_lock calls. One in the function itself and
> another in pse_pi_get_voltage.
> 
> Resolve the issue by using the unlocked version of pse_pi_get_voltage
> instead.
> 
> [...]

Here is the summary with links:
  - [net] net: pse-pd: Fix deadlock in current limit functions
    https://git.kernel.org/netdev/net/c/488fb6effe03

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-13 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 15:17 [PATCH net] net: pse-pd: Fix deadlock in current limit functions Kory Maincent
2025-02-13 18:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox