History

net: pse-pd: Fix deadlock in current limit functions

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.

Kory Maincent committed 1 year ago

Commit 488fb6e1 parent 540cda71 file · +2 −2Browse files

Unified · Split

drivers/net/pse-pd/pse_core.c+2−2
@@ -319,7 +319,7 @@ static int pse_pi_get_current_limit(struct regulator_dev *rdev) · 318 unmodified lines
319319 goto out;
320320 mW = ret;
321321
322− ret = pse_pi_get_voltage(rdev);
322+ ret = _pse_pi_get_voltage(rdev);
323323 if (!ret) {
324324 dev_err(pcdev->dev, "Voltage null\n");
325325 ret = -ERANGE;
@@ -356,7 +356,7 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA, · 30 unmodified lines
356356
357357 id = rdev_get_id(rdev);
358358 mutex_lock(&pcdev->lock);
359− ret = pse_pi_get_voltage(rdev);
359+ ret = _pse_pi_get_voltage(rdev);
360360 if (!ret) {
361361 dev_err(pcdev->dev, "Voltage null\n");
362362 ret = -ERANGE;