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();
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to