From owner-svn-src-all@freebsd.org Sun Feb 14 18:57:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6D9FAA8838; Sun, 14 Feb 2016 18:57:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3A6D128D; Sun, 14 Feb 2016 18:57:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1EIvei6045986; Sun, 14 Feb 2016 18:57:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1EIveiN045985; Sun, 14 Feb 2016 18:57:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201602141857.u1EIveiN045985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 14 Feb 2016 18:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r295615 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2016 18:57:42 -0000 Author: kib Date: Sun Feb 14 18:57:40 2016 New Revision: 295615 URL: https://svnweb.freebsd.org/changeset/base/295615 Log: MFC r294598: In tty_dealloc(), clear the queues. Approved by: re (marius) Modified: stable/10/sys/kern/tty.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/tty.c ============================================================================== --- stable/10/sys/kern/tty.c Sun Feb 14 18:17:58 2016 (r295614) +++ stable/10/sys/kern/tty.c Sun Feb 14 18:57:40 2016 (r295615) @@ -215,7 +215,7 @@ ttydev_leave(struct tty *tp) ttydisc_close(tp); - /* Destroy associated buffers already. */ + /* Free i/o queues now since they might be large. */ ttyinq_free(&tp->t_inq); tp->t_inlow = 0; ttyoutq_free(&tp->t_outq); @@ -1052,10 +1052,15 @@ tty_dealloc(void *arg) { struct tty *tp = arg; - /* Make sure we haven't leaked buffers. */ - MPASS(ttyinq_getsize(&tp->t_inq) == 0); - MPASS(ttyoutq_getsize(&tp->t_outq) == 0); - + /* + * ttyydev_leave() usually frees the i/o queues earlier, but it is + * not always called between queue allocation and here. The queues + * may be allocated by ioctls on a pty control device without the + * corresponding pty slave device ever being open, or after it is + * closed. + */ + ttyinq_free(&tp->t_inq); + ttyoutq_free(&tp->t_outq); seldrain(&tp->t_inpoll); seldrain(&tp->t_outpoll); knlist_destroy(&tp->t_inpoll.si_note);