From owner-svn-src-head@FreeBSD.ORG Thu Dec 20 16:21:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A32A94B0; Thu, 20 Dec 2012 16:21:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBB68FC0C; Thu, 20 Dec 2012 16:21:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKGL32u079169; Thu, 20 Dec 2012 16:21:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKGL3kp079167; Thu, 20 Dec 2012 16:21:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212201621.qBKGL3kp079167@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 20 Dec 2012 16:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244489 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 16:21:03 -0000 Author: hselasky Date: Thu Dec 20 16:21:02 2012 New Revision: 244489 URL: http://svnweb.freebsd.org/changeset/base/244489 Log: Make sure we block recursion on TTY's inwakeup callback Suggested by: davide MFC after: 1 week Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Thu Dec 20 13:27:43 2012 (r244488) +++ head/sys/dev/usb/serial/usb_serial.c Thu Dec 20 16:21:02 2012 (r244489) @@ -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: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Thu Dec 20 13:27:43 2012 (r244488) +++ head/sys/dev/usb/serial/usb_serial.h Thu Dec 20 16:21:02 2012 (r244489) @@ -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;