summaryrefslogtreecommitdiff
path: root/drivers/hwmon/vt8231.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-06-12 13:57:19 +0200
committerMark M. Hoffman <mhoffman@lightlink.com>2007-07-19 14:22:14 -0400
commit04a6217df28e3004ba4e76eb0a356a30f72c564f (patch)
treec2361be6f6a778dc769d77aa3e9ebfe0ebea366d /drivers/hwmon/vt8231.c
parentec5e1a4b8faa6a3522171a185a5c6ac9609e14b4 (diff)
hwmon: Fix a potential race condition on unload
Fix a potential race condition when some hardware monitoring platform drivers are being unloaded. I believe that the driver data pointer shouldn't be cleared before all the sysfs files are removed, otherwise a sysfs callback might attempt to dereference a NULL pointer. I'm not sure exactly what the driver core protects drivers against, so let's play it safe. While we're here, clear the driver data pointer when probe fails, so as to not leave an invalid pointer behind us. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/vt8231.c')
-rw-r--r--drivers/hwmon/vt8231.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 320d8141be78..c604972f0186 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -743,6 +743,7 @@ exit_remove_files:
sysfs_remove_group(&pdev->dev.kobj, &vt8231_group);
exit_free:
+ platform_set_drvdata(pdev, NULL);
kfree(data);
exit_release: