Skip to content

Commit

Permalink
sd: call sd_zbc_release_disk before releasing the scsi_device reference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Mar 9, 2022
1 parent fad45c3 commit c76c46f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c76c46f

Please sign in to comment.