]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
sd: call sd_zbc_release_disk before releasing the scsi_device reference
authorChristoph Hellwig <hch@lst.de>
Tue, 8 Mar 2022 05:51:51 +0000 (06:51 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Mar 2022 02:40:01 +0000 (19:40 -0700)
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>
drivers/scsi/sd.c

index 7479e7cb36b431adced133faa88dadb4f8865d3b..7bfebf5b2832de4cc5e7033e97d682f46c83077f 100644 (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);
 }