Message ID | 20220304160331.399757-7-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/14] blk-mq: do not include passthrough requests in I/O accounting | expand |
On 3/4/22 08:03, Christoph Hellwig wrote: > Call free_opal_dev from scsi_disk_release as the opal_dev field is access > from the ioctl handler, which isn't synchronized vs sd_release and thus > can be accesses during or after sd_release was called. Reviewed-by: Bart Van Assche <bvanassche@acm.org>
On Fri, Mar 04, 2022 at 05:03:23PM +0100, Christoph Hellwig wrote: > Call free_opal_dev from scsi_disk_release as the opal_dev field is access > from the ioctl handler, which isn't synchronized vs sd_release and thus > can be accesses during or after sd_release was called. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ming Lei <ming.lei@redhat.com>
On 3/4/22 08:03, Christoph Hellwig wrote: > Call free_opal_dev from scsi_disk_release as the opal_dev field is access > from the ioctl handler, which isn't synchronized vs sd_release and thus > can be accesses during or after sd_release was called. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Christoph, > Call free_opal_dev from scsi_disk_release as the opal_dev field is > access accessed? > from the ioctl handler, which isn't synchronized vs sd_release and thus > can be accesses during or after sd_release was called. accessed? Otherwise fine. Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7bfebf5b2832d..346b8d62de7d1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -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); }
Call free_opal_dev from scsi_disk_release as the opal_dev field is access from the ioctl handler, which isn't synchronized vs sd_release and thus can be accesses during or after sd_release was called. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/scsi/sd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)