Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2020 20:20:42 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366584 - head/sys/kern
Message-ID:  <202010092020.099KKgPM030799@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010092020.099KKgPM030799>