Skip to content

Commit

Permalink
mtip32xx: fix for crash when the device surprise removed during rebuild
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Asai Thambi S P authored and Jens Axboe committed Jan 11, 2013
1 parent 47cd4b3 commit 58c49df
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,12 @@ static int mtip_block_remove(struct driver_data *dd)
* Delete our gendisk structure. This also removes the device
* from /dev
*/
del_gendisk(dd->disk);
if (dd->disk) {
if (dd->disk->queue)
del_gendisk(dd->disk);
else
put_disk(dd->disk);
}

spin_lock(&rssd_index_lock);
ida_remove(&rssd_index_ida, dd->index);
Expand Down Expand Up @@ -3922,7 +3927,13 @@ static int mtip_block_shutdown(struct driver_data *dd)
"Shutting down %s ...\n", dd->disk->disk_name);

/* Delete our gendisk structure, and cleanup the blk queue. */
del_gendisk(dd->disk);
if (dd->disk) {
if (dd->disk->queue)
del_gendisk(dd->disk);
else
put_disk(dd->disk);
}


spin_lock(&rssd_index_lock);
ida_remove(&rssd_index_ida, dd->index);
Expand Down

0 comments on commit 58c49df

Please sign in to comment.