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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "[email protected]"

Reply via email to