Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb In ucompoll() also bail out if we don't have a v...
details: https://anonhg.NetBSD.org/src/rev/7ba6ec12bbfe
branches: trunk
changeset: 772734:7ba6ec12bbfe
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sat Jan 14 20:25:45 2012 +0000
description:
In ucompoll() also bail out if we don't have a valid softc.
Seems to prevent occasional crashes when a open ucom is removed.
diffstat:
sys/dev/usb/ucom.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (38 lines):
diff -r 4fda08526d2c -r 7ba6ec12bbfe sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c Sat Jan 14 20:20:31 2012 +0000
+++ b/sys/dev/usb/ucom.c Sat Jan 14 20:25:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.93 2011/12/23 00:51:45 jakllsch Exp $ */
+/* $NetBSD: ucom.c,v 1.94 2012/01/14 20:25:45 jakllsch Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.93 2011/12/23 00:51:45 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.94 2012/01/14 20:25:45 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -656,13 +656,16 @@
int
ucompoll(dev_t dev, int events, struct lwp *l)
{
- struct ucom_softc *sc = device_lookup_private(&ucom_cd, UCOMUNIT(dev));
- struct tty *tp = sc->sc_tty;
+ struct ucom_softc *sc;
+ struct tty *tp;
int revents;
- if (sc->sc_dying)
+ sc = device_lookup_private(&ucom_cd, UCOMUNIT(dev));
+ if (sc == NULL || sc->sc_dying)
return (POLLHUP);
+ tp = sc->sc_tty;
+
sc->sc_refcnt++;
revents = ((*tp->t_linesw->l_poll)(tp, events, l));
if (--sc->sc_refcnt < 0)
Home |
Main Index |
Thread Index |
Old Index