mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 22:34:33 +01:00
hwmon: (occ) Lock mutex in shutdown to prevent race with occ_active
Unbinding the driver or removing the parent device at the same time as using the OCC active sysfs file can cause the driver to unregister the hwmon device twice. Prevent this by locking the occ mutex in the shutdown function. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
1 parent
5e3f89ad8e
commit
ac6888ac5a
1 file changed
+5
@@ -1228,10 +1228,15 @@ EXPORT_SYMBOL_GPL(occ_setup);
|
||||
|
||||
void occ_shutdown(struct occ *occ)
|
||||
{
|
||||
mutex_lock(&occ->lock);
|
||||
|
||||
occ_shutdown_sysfs(occ);
|
||||
|
||||
if (occ->hwmon)
|
||||
hwmon_device_unregister(occ->hwmon);
|
||||
occ->hwmon = NULL;
|
||||
|
||||
mutex_unlock(&occ->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(occ_shutdown);
|
||||
|
||||
|
||||
Reference in new issue
Block a user