From owner-svn-src-all@FreeBSD.ORG Fri Jun 28 03:39:55 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3E423AAF; Fri, 28 Jun 2013 03:39:55 +0000 (UTC) (envelope-from lstewart@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 3021E1FB9; Fri, 28 Jun 2013 03:39:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S3dstq093549; Fri, 28 Jun 2013 03:39:54 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3dseI093548; Fri, 28 Jun 2013 03:39:54 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280339.r5S3dseI093548@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252328 - stable/9/sys/kern X-SVN-Group: stable-9 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.14 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: Fri, 28 Jun 2013 03:39:55 -0000 Author: lstewart Date: Fri Jun 28 03:39:54 2013 New Revision: 252328 URL: http://svnweb.freebsd.org/changeset/base/252328 Log: MFC r251725: Fix a potential NULL-pointer dereference that would trigger if the hhook registration site did not provide storage for a copy of the hhook_head struct. Modified: stable/9/sys/kern/kern_hhook.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_hhook.c ============================================================================== --- stable/9/sys/kern/kern_hhook.c Fri Jun 28 03:23:24 2013 (r252327) +++ stable/9/sys/kern/kern_hhook.c Fri Jun 28 03:39:54 2013 (r252328) @@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, STAILQ_INIT(&tmphhh->hhh_hooks); HHH_LOCK_INIT(tmphhh); - if (hhh != NULL) + if (hhh != NULL) { refcount_init(&tmphhh->hhh_refcount, 1); - else + *hhh = tmphhh; + } else refcount_init(&tmphhh->hhh_refcount, 0); if (flags & HHOOK_HEADISINVNET) { @@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, /* XXXLAS: Add tmphhh to the non-virtualised list. */ } - *hhh = tmphhh; - return (0); }