Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Sep 2000 20:09:12 +0300
From:      Valentin Nechayev <netch@segfault.kiev.ua>
To:        freebsd-bugs@freebsd.org
Subject:   src/sys/isa/sio.c
Message-ID:  <20000905200912.A4144@nn.kiev.ua>

next in thread | raw e-mail | index | archive | help
It seems to me that in some cases, sioopen() does not restore spl.
Also, comhardclose() and testing com->wopeners may require spltty (but I'm
not sure). The patch in question follows.
Original version is
`FreeBSD: src/sys/isa/sio.c,v 1.304 2000/08/15 21:03:28 peter Exp'

--- sio.c.orig	Wed Aug 16 23:08:21 2000
+++ sio.c	Tue Sep  5 19:37:21 2000
@@ -1380,8 +1380,10 @@
 open_top:
 	while (com->state & CS_DTR_OFF) {
 		error = tsleep(&com->dtr_wait, TTIPRI | PCATCH, "siodtr", 0);
-		if (com_addr(unit) == NULL)
+		if (com_addr(unit) == NULL) {
+			splx(s);
 			return (ENXIO);
+		}
 		if (error != 0 || com->gone)
 			goto out;
 	}
@@ -1403,8 +1405,10 @@
 				}
 				error =	tsleep(&com->active_out,
 					       TTIPRI | PCATCH, "siobi", 0);
-				if (com_addr(unit) == NULL)
-					return (ENXIO);
+				if (com_addr(unit) == NULL) {
+					error = ENXIO;
+					goto out;
+				}
 				if (error != 0 || com->gone)
 					goto out;
 				goto open_top;
@@ -1511,8 +1515,10 @@
 	    && !(tp->t_cflag & CLOCAL) && !(flag & O_NONBLOCK)) {
 		++com->wopeners;
 		error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "siodcd", 0);
-		if (com_addr(unit) == NULL)
-			return (ENXIO);
+		if (com_addr(unit) == NULL) {
+			error = ENXIO;
+			goto out;
+		}
 		--com->wopeners;
 		if (error != 0 || com->gone)
 			goto out;
@@ -1524,9 +1530,9 @@
 		com->active_out = TRUE;
 	siosettimeout();
 out:
-	splx(s);
 	if (!(tp->t_state & TS_ISOPEN) && com->wopeners == 0)
 		comhardclose(com);
+	splx(s);
 	return (error);
 }
 

/netch


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000905200912.A4144>