hwmon: Fix a potential race condition on unload
authorJean Delvare <khali@linux-fr.org>
Tue, 12 Jun 2007 11:57:19 +0000 (13:57 +0200)
committerMark M. Hoffman <mhoffman@lightlink.com>
Thu, 19 Jul 2007 18:22:14 +0000 (14:22 -0400)
commit04a6217df28e3004ba4e76eb0a356a30f72c564f
treec2361be6f6a778dc769d77aa3e9ebfe0ebea366d
parentec5e1a4b8faa6a3522171a185a5c6ac9609e14b4
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>
drivers/hwmon/abituguru.c
drivers/hwmon/f71805f.c
drivers/hwmon/pc87427.c
drivers/hwmon/smsc47m1.c
drivers/hwmon/vt8231.c
drivers/hwmon/w83627hf.c