svn commit: r252329 - stable/8/sys/kern

Lawrence Stewart lstewart at FreeBSD.org
Fri Jun 28 03:41:23 UTC 2013


Author: lstewart
Date: Fri Jun 28 03:41:23 2013
New Revision: 252329
URL: http://svnweb.freebsd.org/changeset/base/252329

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/8/sys/kern/kern_hhook.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_hhook.c
==============================================================================
--- stable/8/sys/kern/kern_hhook.c	Fri Jun 28 03:39:54 2013	(r252328)
+++ stable/8/sys/kern/kern_hhook.c	Fri Jun 28 03:41:23 2013	(r252329)
@@ -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);
 }
 


More information about the svn-src-all mailing list