mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-09 07:51:02 +08:00
platform/x86: dell-ddv: Fix taking the psy->extensions_sem lock twice
Calling power_supply_get_property() inside
dell_wmi_ddv_battery_translate() can cause a deadlock since this
function is also being called from the power supply extension code,
in which case psy->extensions_sem is already being held.
Fix this by using the new power_supply_get_property_direct() function
to ignore any power supply extensions when retrieving the battery
serial number.
Tested on a Dell Inspiron 3505.
Reported-by: Hans de Goede <hansg@kernel.org>
Fixes: 058de163a3 ("platform/x86: dell-ddv: Implement the battery matching algorithm")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20250627205124.250433-3-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
committed by
Ilpo Järvinen
parent
a5f3542321
commit
d4e83784b2
@@ -689,9 +689,13 @@ static int dell_wmi_ddv_battery_translate(struct dell_wmi_ddv_data *data,
|
||||
|
||||
dev_dbg(&data->wdev->dev, "Translation cache miss\n");
|
||||
|
||||
/* Perform a translation between a ACPI battery and a battery index */
|
||||
|
||||
ret = power_supply_get_property(battery, POWER_SUPPLY_PROP_SERIAL_NUMBER, &val);
|
||||
/*
|
||||
* Perform a translation between a ACPI battery and a battery index.
|
||||
* We have to use power_supply_get_property_direct() here because this
|
||||
* function will also get called from the callbacks of the power supply
|
||||
* extension.
|
||||
*/
|
||||
ret = power_supply_get_property_direct(battery, POWER_SUPPLY_PROP_SERIAL_NUMBER, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user