From owner-freebsd-stable Mon Mar 12 7:21: 1 2001 Delivered-To: freebsd-stable@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 3AED237B718 for ; Mon, 12 Mar 2001 07:20:55 -0800 (PST) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 12 Mar 2001 15:20:54 +0000 (GMT) To: j mckitrick Cc: Alfred Perlstein , freebsd-stable@freebsd.org, iedowse@maths.tcd.ie Subject: Re: suspend/restore with ppp connections In-Reply-To: Your message of "Mon, 12 Mar 2001 14:56:22 GMT." <20010312145622.A87895@dogma.freebsd-uk.eu.org> Date: Mon, 12 Mar 2001 15:20:54 +0000 From: Ian Dowse Message-ID: <200103121520.aa08765@salmon.maths.tcd.ie> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <20010312145622.A87895@dogma.freebsd-uk.eu.org>, j mckitrick writes: > >Now this is the kind of thing I would be interested in helping fix. But if >you say sio has bigger problems, I might be in over my head. What would >happen if I just added those tests for NULL? You could try something like the patch below - I'm sure this isn't the right way to fix this - the struct tty leaks will still happen here. However it may be enough to avoids the page faults and make suspend/resume while a pccard serial port is open a bit more reliable. Someone who knows the tty code better than I do might be able to explain how to deal with a tty going away while it is open. It seems that the `t_gen' field should help with that, so the sio driver certainly shouldn't be mallocing a new tty every time a card is reattached. Ian Index: sio.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/sys/isa/sio.c,v retrieving revision 1.291.2.15 diff -u -r1.291.2.15 sio.c --- sio.c 2001/02/26 04:23:14 1.291.2.15 +++ sio.c 2001/03/12 15:10:02 @@ -560,6 +560,7 @@ if (com->tp && (com->tp->t_state & TS_ISOPEN)) { device_printf(dev, "still open, forcing close\n"); com->tp->t_gen++; + (*linesw[com->tp->t_line].l_close)(com->tp, 0); ttyclose(com->tp); ttwakeup(com->tp); ttwwakeup(com->tp); @@ -1386,7 +1387,7 @@ error = tsleep(&com->dtr_wait, TTIPRI | PCATCH, "siodtr", 0); if (com_addr(unit) == NULL) return (ENXIO); - if (error != 0 || com->gone) + if (error != 0 || com->gone || com->tp == NULL) goto out; } if (tp->t_state & TS_ISOPEN) { @@ -1409,7 +1410,7 @@ TTIPRI | PCATCH, "siobi", 0); if (com_addr(unit) == NULL) return (ENXIO); - if (error != 0 || com->gone) + if (error != 0 || com->gone || com->tp == NULL) goto out; goto open_top; } @@ -1518,7 +1519,7 @@ if (com_addr(unit) == NULL) return (ENXIO); --com->wopeners; - if (error != 0 || com->gone) + if (error != 0 || com->gone || com->tp == NULL) goto out; goto open_top; } @@ -1550,7 +1551,7 @@ if (mynor & CONTROL_MASK) return (0); com = com_addr(MINOR_TO_UNIT(mynor)); - if (com == NULL) + if (com == NULL || com->tp == NULL) return (ENODEV); tp = com->tp; s = spltty(); @@ -1637,7 +1638,7 @@ if (mynor & CONTROL_MASK) return (ENODEV); com = com_addr(MINOR_TO_UNIT(mynor)); - if (com == NULL || com->gone) + if (com == NULL || com->gone || com->tp == NULL) return (ENODEV); return ((*linesw[com->tp->t_line].l_read)(com->tp, uio, flag)); } @@ -1658,7 +1659,7 @@ unit = MINOR_TO_UNIT(mynor); com = com_addr(unit); - if (com == NULL || com->gone) + if (com == NULL || com->gone || com->tp == NULL) return (ENODEV); /* * (XXX) We disallow virtual consoles if the physical console is @@ -2076,7 +2077,7 @@ mynor = minor(dev); com = com_addr(MINOR_TO_UNIT(mynor)); - if (com == NULL || com->gone) + if (com == NULL || com->gone || com->tp == NULL) return (ENODEV); if (mynor & CONTROL_MASK) { struct termios *ct; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message