From: Christoph Hellwig Date: Tue, 8 Mar 2022 05:51:51 +0000 (+0100) Subject: sd: call sd_zbc_release_disk before releasing the scsi_device reference X-Git-Tag: v6.6.17~7816^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c76c46fa04c42f7d3a494c526ce5f030da36b553;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Bart Van Assche Reviewed-by: Ming Lei Reviewed-by: Martin K. Petersen Link: https://lore.kernel.org/r/20220308055200.735835-6-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7479e7c..7bfebf5 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); }