svn commit: r350507 - head/sys/net

Eric Joyner erj at FreeBSD.org
Thu Aug 1 17:28:37 UTC 2019


Author: erj
Date: Thu Aug  1 17:28:36 2019
New Revision: 350507
URL: https://svnweb.freebsd.org/changeset/base/350507

Log:
  iflib: remove kobject class reference increment
  
  Commit message from Jake:
  In iflib_register, the context is initialized as a kobject using the
  device driver's "driver" kobject class. As part of this, the function
  mistakenly increments the ref counter.
  
  The ref counter is incremented twice, once in the code directly, and
  once again by kobj_class_compile. However, there is no associated
  decrement in the detach path. Because of this, the ref counter will
  never go back down to zero, and thus the kobject method table will never
  be released.
  
  Remove this unnecessary reference count increment.
  
  Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
  
  Submitted by:	Jacob Keller <jacob.e.keller at intel.com>
  Reviewed by:	jhb@, erj@
  MFC after:	3 days
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D21125

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Aug  1 17:02:58 2019	(r350506)
+++ head/sys/net/iflib.c	Thu Aug  1 17:28:36 2019	(r350507)
@@ -5342,7 +5342,6 @@ iflib_register(if_ctx_t ctx)
 	 */
 	kobj_init((kobj_t) ctx, (kobj_class_t) driver);
 	kobj_class_compile((kobj_class_t) driver);
-	driver->refs++;
 
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	if_setsoftc(ifp, ctx);


More information about the svn-src-head mailing list