summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_ch.c
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1998-11-22 23:44:47 +0000
committerken <ken@FreeBSD.org>1998-11-22 23:44:47 +0000
commit7db1d5d9598a5047cf40b7cd3e796316f31fb862 (patch)
treeaaad8d95d4e3fc660777729c9d57db90e8e67156 /sys/cam/scsi/scsi_ch.c
parenteb4cacd5811d8cc0ba8272b8f34e894b6326a222 (diff)
downloadFreeBSD-src-7db1d5d9598a5047cf40b7cd3e796316f31fb862.zip
FreeBSD-src-7db1d5d9598a5047cf40b7cd3e796316f31fb862.tar.gz
Fix a few problems that Bruce noticed about a month ago, and fix oup one
other problem. - Hold onto splsoftcam() in the peripheral driver open routines until we have locked the periph. This eliminates a race condition. - Disallow opening the pass driver when securelevel > 1. - If a user tries to open the pass driver with O_NONBLOCK set, return EINVAL instead of ENODEV. (noticed by gibbs)
Diffstat (limited to 'sys/cam/scsi/scsi_ch.c')
-rw-r--r--sys/cam/scsi/scsi_ch.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index 32bb92d..aa0883f 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_ch.c,v 1.4 1998/10/15 17:46:26 ken Exp $
+ * $Id: scsi_ch.c,v 1.5 1998/10/22 22:16:56 ken Exp $
*/
/*
* Derived from the NetBSD SCSI changer driver.
@@ -458,11 +458,14 @@ chopen(dev_t dev, int flags, int fmt, struct proc *p)
splx(s);
return(ENXIO);
}
- splx(s);
- if ((error = cam_periph_lock(periph, PRIBIO | PCATCH)) != 0)
+ if ((error = cam_periph_lock(periph, PRIBIO | PCATCH)) != 0) {
+ splx(s);
return (error);
+ }
+ splx(s);
+
if ((softc->flags & CH_FLAG_OPEN) == 0) {
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
return(ENXIO);
OpenPOWER on IntegriCloud