aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d42fa6468f41..ba9c3e0387ce 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -467,22 +467,27 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
467 467
468static int sr_block_open(struct block_device *bdev, fmode_t mode) 468static int sr_block_open(struct block_device *bdev, fmode_t mode)
469{ 469{
470 struct scsi_cd *cd = scsi_cd_get(bdev->bd_disk); 470 struct scsi_cd *cd;
471 int ret = -ENXIO; 471 int ret = -ENXIO;
472 472
473 lock_kernel();
474 cd = scsi_cd_get(bdev->bd_disk);
473 if (cd) { 475 if (cd) {
474 ret = cdrom_open(&cd->cdi, bdev, mode); 476 ret = cdrom_open(&cd->cdi, bdev, mode);
475 if (ret) 477 if (ret)
476 scsi_cd_put(cd); 478 scsi_cd_put(cd);
477 } 479 }
480 unlock_kernel();
478 return ret; 481 return ret;
479} 482}
480 483
481static int sr_block_release(struct gendisk *disk, fmode_t mode) 484static int sr_block_release(struct gendisk *disk, fmode_t mode)
482{ 485{
483 struct scsi_cd *cd = scsi_cd(disk); 486 struct scsi_cd *cd = scsi_cd(disk);
487 lock_kernel();
484 cdrom_release(&cd->cdi, mode); 488 cdrom_release(&cd->cdi, mode);
485 scsi_cd_put(cd); 489 scsi_cd_put(cd);
490 unlock_kernel();
486 return 0; 491 return 0;
487} 492}
488 493