mtip32xx: Fix NULL pointer dereference during module unload
authorSam Bradshaw <sbradshaw@micron.com>
Wed, 15 May 2013 08:04:34 +0000 (10:04 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 May 2013 08:04:34 +0000 (10:04 +0200)
An open file-handle to one or more of the driver exported debugfs
nodes causes raciness in recursive removal during module unload;
sometimes a stale parent dentry is dereferenced when more than 1
pci device is present.

Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/mtip32xx/mtip32xx.c

index 847107ef0cce52c65c4ff1f1aeaab6a1b4540922..e366c745ec184f97fce7cc755e43b934ba6a3971 100644 (file)
@@ -3002,7 +3002,8 @@ static int mtip_hw_debugfs_init(struct driver_data *dd)
 
 static void mtip_hw_debugfs_exit(struct driver_data *dd)
 {
-       debugfs_remove_recursive(dd->dfs_node);
+       if (dd->dfs_node)
+               debugfs_remove_recursive(dd->dfs_node);
 }