Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58c49df3 authored by Asai Thambi S P's avatar Asai Thambi S P Committed by Jens Axboe
Browse files

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: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 47cd4b3c
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -3888,7 +3888,12 @@ static int mtip_block_remove(struct driver_data *dd)
	 * Delete our gendisk structure. This also removes the device
	 * from /dev
	 */
	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);
@@ -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. */
	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);