summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2007-07-21 18:07:45 +0000
committerkan <kan@FreeBSD.org>2007-07-21 18:07:45 +0000
commitd137611353413c1460e97b195a581ecc3ec8d718 (patch)
tree054f0318a06aa7a38697ed9b75cac19b6d17a260 /sys/cam
parentbfde2cbba61590ea3728942b4b9a0dbcec97ed0e (diff)
downloadFreeBSD-src-d137611353413c1460e97b195a581ecc3ec8d718.zip
FreeBSD-src-d137611353413c1460e97b195a581ecc3ec8d718.tar.gz
Do not forget to cam_periph_unhold the peripheral before exiting
due to error. PR: kern/114636 Submitted by: Tijl Coosemans Approved by: re (hrs)
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_cd.c7
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) {
OpenPOWER on IntegriCloud