sd: delay calling free_opal_dev
Call free_opal_dev from scsi_disk_release as the opal_dev field is accessed from the ioctl handler, which isn't synchronized vs sd_release and thus can be accessed during or after sd_release was called. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> 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-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
c76c46fa04
commit
534cf52aa9
@ -3632,8 +3632,6 @@ static int sd_remove(struct device *dev)
|
||||
del_gendisk(sdkp->disk);
|
||||
sd_shutdown(dev);
|
||||
|
||||
free_opal_dev(sdkp->opal_dev);
|
||||
|
||||
mutex_lock(&sd_ref_mutex);
|
||||
dev_set_drvdata(dev, NULL);
|
||||
put_device(&sdkp->disk_dev);
|
||||
@ -3675,6 +3673,7 @@ static void scsi_disk_release(struct device *dev)
|
||||
|
||||
sd_zbc_release_disk(sdkp);
|
||||
put_device(&sdkp->device->sdev_gendev);
|
||||
free_opal_dev(sdkp->opal_dev);
|
||||
|
||||
kfree(sdkp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user