sd: call sd_zbc_release_disk before releasing the scsi_device reference

sd_zbc_release_disk accesses disk->device, so ensure that actually still has
a valid reference.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20220308055200.735835-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2022-03-08 06:51:51 +01:00 committed by Jens Axboe
parent fad45c3007
commit c76c46fa04

View File

@ -3672,9 +3672,9 @@ static void scsi_disk_release(struct device *dev)
disk->private_data = NULL;
put_disk(disk);
put_device(&sdkp->device->sdev_gendev);
sd_zbc_release_disk(sdkp);
put_device(&sdkp->device->sdev_gendev);
kfree(sdkp);
}