• Jean Delvare's avatar
    hwmon: Fix a potential race condition on unload · 04a6217d
    Jean Delvare authored
    
    
    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: default avatarJean Delvare <khali@linux-fr.org>
    Signed-off-by: default avatarMark M. Hoffman <mhoffman@lightlink.com>
    04a6217d
f71805f.c 41.6 KB