svn commit: r366584 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Fri Oct 9 20:20:43 UTC 2020


Author: jhb
Date: Fri Oct  9 20:20:42 2020
New Revision: 366584
URL: https://svnweb.freebsd.org/changeset/base/366584

Log:
  Don't invoke semunload() if seminit() fails during MOD_LOAD.
  
  The module handler code invokes a MOD_UNLOAD event immediately if
  MOD_LOAD fails.  The result was that if seminit() failed, semunload()
  was invoked twice.  semunload() is not idempotent however and would
  try to remove it's process_exit eventhandler twice resulting in a
  panic.
  
  Reviewed by:	kib, markj
  Obtained from:	CheriBSD
  MFC after:	1 month
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D26696

Modified:
  head/sys/kern/sysv_sem.c

Modified: head/sys/kern/sysv_sem.c
==============================================================================
--- head/sys/kern/sysv_sem.c	Fri Oct  9 19:12:44 2020	(r366583)
+++ head/sys/kern/sysv_sem.c	Fri Oct  9 20:20:42 2020	(r366584)
@@ -381,8 +381,6 @@ sysvsem_modload(struct module *module, int cmd, void *
 	switch (cmd) {
 	case MOD_LOAD:
 		error = seminit();
-		if (error != 0)
-			semunload();
 		break;
 	case MOD_UNLOAD:
 		error = semunload();


More information about the svn-src-all mailing list