Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic PR/16058: Tero Kivinen: Don't free rbuf or detach...
details: https://anonhg.NetBSD.org/src/rev/c2f9716c762d
branches: trunk
changeset: 525600:c2f9716c762d
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 13 17:05:16 2002 +0000
description:
PR/16058: Tero Kivinen: Don't free rbuf or detach tty if rbuf allocation
failed during attach phase.
diffstat:
sys/dev/ic/com.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r fbbb487bda96 -r c2f9716c762d sys/dev/ic/com.c
--- a/sys/dev/ic/com.c Sat Apr 13 16:40:32 2002 +0000
+++ b/sys/dev/ic/com.c Sat Apr 13 17:05:16 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.195 2002/04/12 19:32:30 thorpej Exp $ */
+/* $NetBSD: com.c,v 1.196 2002/04/13 17:05:16 christos Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.195 2002/04/12 19:32:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.196 2002/04/13 17:05:16 christos Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -660,6 +660,15 @@
mn |= COMDIALOUT_MASK;
vdevgone(maj, mn, mn, VCHR);
+ if (sc->sc_rbuf == NULL) {
+ /*
+ * Ring buffer allocation failed in the com_attach_subr,
+ * only the tty is allocated, and nothing else.
+ */
+ ttyfree(sc->sc_tty);
+ return 0;
+ }
+
/* Free the receive buffer. */
free(sc->sc_rbuf, M_DEVBUF);
Home |
Main Index |
Thread Index |
Old Index