diff options
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 118e977..f8fe11d 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -1860,14 +1860,17 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) && (cmd != CDIOCEJECT)) && (IOCGROUP(cmd) == 'c')) { error = cdcheckmedia(periph); + if (error != 0) { + cam_periph_unhold(periph); + cam_periph_unlock(periph); + return (error); + } } /* * Drop the lock here so later mallocs can use WAITOK. The periph * is essentially locked still with the cam_periph_hold call above. */ cam_periph_unlock(periph); - if (error != 0) - return (error); nocopyout = 0; switch (cmd) { |