sd_zbc_release_disk accesses disk->device, so ensure that actually still has a valid reference. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx> Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> --- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7479e7cb36b43..7bfebf5b2832d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -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); } -- 2.30.2