Date: Fri, 14 Jun 2013 02:25:41 +0000 (UTC) From: Lawrence Stewart <lstewart@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251725 - head/sys/kern Message-ID: <201306140225.r5E2Pfhw016489@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: lstewart Date: Fri Jun 14 02:25:40 2013 New Revision: 251725 URL: http://svnweb.freebsd.org/changeset/base/251725 Log: 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. MFC after: 3 days Modified: head/sys/kern/kern_hhook.c Modified: head/sys/kern/kern_hhook.c ============================================================================== --- head/sys/kern/kern_hhook.c Fri Jun 14 02:21:32 2013 (r251724) +++ head/sys/kern/kern_hhook.c Fri Jun 14 02:25:40 2013 (r251725) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306140225.r5E2Pfhw016489>