diff options
author | Asai Thambi S P <asamymuthupa@micron.com> | 2013-01-11 08:17:12 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-01-11 08:35:58 -0500 |
commit | 58c49df378cde4ff64172483d593a1a5689c13a8 (patch) | |
tree | 561681531660ae0f29ecc286cf921ab48ee11f2a /drivers/block/mtip32xx/mtip32xx.c | |
parent | 47cd4b3c7e80cc8d5ac82930c5af835870b5aba1 (diff) |
mtip32xx: fix for crash when the device surprise removed during rebuild
When rebuild is in progress, disk->queue is yet to be created. Surprise
removing the device will call remove()-> del_gendisk(). del_gendisk()
expect disk->queue be not NULL. Fix is to call put_disk() when disk_queue
is NULL.
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/mtip32xx/mtip32xx.c')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index b93282019632..3fd100990453 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3888,7 +3888,12 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3888 | * Delete our gendisk structure. This also removes the device | 3888 | * Delete our gendisk structure. This also removes the device |
3889 | * from /dev | 3889 | * from /dev |
3890 | */ | 3890 | */ |
3891 | del_gendisk(dd->disk); | 3891 | if (dd->disk) { |
3892 | if (dd->disk->queue) | ||
3893 | del_gendisk(dd->disk); | ||
3894 | else | ||
3895 | put_disk(dd->disk); | ||
3896 | } | ||
3892 | 3897 | ||
3893 | spin_lock(&rssd_index_lock); | 3898 | spin_lock(&rssd_index_lock); |
3894 | ida_remove(&rssd_index_ida, dd->index); | 3899 | ida_remove(&rssd_index_ida, dd->index); |
@@ -3922,7 +3927,13 @@ static int mtip_block_shutdown(struct driver_data *dd) | |||
3922 | "Shutting down %s ...\n", dd->disk->disk_name); | 3927 | "Shutting down %s ...\n", dd->disk->disk_name); |
3923 | 3928 | ||
3924 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 3929 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
3925 | del_gendisk(dd->disk); | 3930 | if (dd->disk) { |
3931 | if (dd->disk->queue) | ||
3932 | del_gendisk(dd->disk); | ||
3933 | else | ||
3934 | put_disk(dd->disk); | ||
3935 | } | ||
3936 | |||
3926 | 3937 | ||
3927 | spin_lock(&rssd_index_lock); | 3938 | spin_lock(&rssd_index_lock); |
3928 | ida_remove(&rssd_index_ida, dd->index); | 3939 | ida_remove(&rssd_index_ida, dd->index); |