Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Dec 2012 12:10:41 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r244813 - stable/9/sys/dev/usb/serial
Message-ID:  <201212291210.qBTCAfFU019822@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sat Dec 29 12:10:41 2012
New Revision: 244813
URL: http://svnweb.freebsd.org/changeset/base/244813

Log:
  MFC r244489:
  Make sure we block recursion on TTY's inwakeup callback
  
  Suggested by: davide

Modified:
  stable/9/sys/dev/usb/serial/usb_serial.c
  stable/9/sys/dev/usb/serial/usb_serial.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- stable/9/sys/dev/usb/serial/usb_serial.c	Sat Dec 29 08:26:20 2012	(r244812)
+++ stable/9/sys/dev/usb/serial/usb_serial.c	Sat Dec 29 12:10:41 2012	(r244813)
@@ -797,10 +797,14 @@ ucom_inwakeup(struct tty *tp)
 	DPRINTF("tp=%p\n", tp);
 
 	if (ttydisc_can_bypass(tp) != 0 || 
-	    (sc->sc_flag & UCOM_FLAG_HL_READY) == 0) {
+	    (sc->sc_flag & UCOM_FLAG_HL_READY) == 0 ||
+	    (sc->sc_flag & UCOM_FLAG_INWAKEUP) != 0) {
 		return;
 	}
 
+	/* prevent recursion */
+	sc->sc_flag |= UCOM_FLAG_INWAKEUP;
+
 	pos = sc->sc_jitterbuf_out;
 
 	while (sc->sc_jitterbuf_in != pos) {
@@ -821,6 +825,8 @@ ucom_inwakeup(struct tty *tp)
 	if ((sc->sc_jitterbuf_in == pos) && 
 	    (sc->sc_flag & UCOM_FLAG_RTS_IFLOW))
 		ucom_rts(sc, 0);
+
+	sc->sc_flag &= ~UCOM_FLAG_INWAKEUP;
 }
 
 static int

Modified: stable/9/sys/dev/usb/serial/usb_serial.h
==============================================================================
--- stable/9/sys/dev/usb/serial/usb_serial.h	Sat Dec 29 08:26:20 2012	(r244812)
+++ stable/9/sys/dev/usb/serial/usb_serial.h	Sat Dec 29 12:10:41 2012	(r244813)
@@ -183,6 +183,7 @@ struct ucom_softc {
 #define	UCOM_FLAG_CONSOLE	0x80	/* set if device is a console */
 #define	UCOM_FLAG_WAIT_REFS   0x0100	/* set if we must wait for refs */
 #define	UCOM_FLAG_FREE_UNIT   0x0200	/* set if we must free the unit */
+#define	UCOM_FLAG_INWAKEUP    0x0400	/* set if we are in the tsw_inwakeup callback */
 	uint8_t	sc_lsr;
 	uint8_t	sc_msr;
 	uint8_t	sc_mcr;



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