From owner-svn-src-stable@FreeBSD.ORG Fri Dec 30 19:58:06 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E66D5106566C; Fri, 30 Dec 2011 19:58:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE1048FC25; Fri, 30 Dec 2011 19:58:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBUJw6IV027805; Fri, 30 Dec 2011 19:58:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBUJw6q0027803; Fri, 30 Dec 2011 19:58:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112301958.pBUJw6q0027803@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 30 Dec 2011 19:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229016 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2011 19:58:07 -0000 Author: kib Date: Fri Dec 30 19:58:06 2011 New Revision: 229016 URL: http://svn.freebsd.org/changeset/base/229016 Log: MFC r228178: If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is -1. But, because ino_t is unsigned, this case was not covered by the test ino > 0 in pipeclose(), leading to the free_unr(-1). Fix it by explicitely comparing with 0 and -1. Do no access freed memory, the inode number was cached to prevent access to cpipe after it possibly was freed, but I failed to commit the right patch. Modified: stable/9/sys/kern/sys_pipe.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sys_pipe.c ============================================================================== --- stable/9/sys/kern/sys_pipe.c Fri Dec 30 19:24:53 2011 (r229015) +++ stable/9/sys/kern/sys_pipe.c Fri Dec 30 19:58:06 2011 (r229016) @@ -1554,8 +1554,8 @@ pipeclose(cpipe) } else PIPE_UNLOCK(cpipe); - if (ino > 0) - free_unr(pipeino_unr, cpipe->pipe_ino); + if (ino != 0 && ino != (ino_t)-1) + free_unr(pipeino_unr, ino); } /*ARGSUSED*/