Author: jhb
Date: Thu Dec 10 22:26:51 2020
New Revision: 368528
URL: https://svnweb.freebsd.org/changeset/base/368528

Log:
  MFC 366584: 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.

Modified:
  stable/12/sys/kern/sysv_sem.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/sysv_sem.c
==============================================================================
--- stable/12/sys/kern/sysv_sem.c       Thu Dec 10 22:20:20 2020        
(r368527)
+++ stable/12/sys/kern/sysv_sem.c       Thu Dec 10 22:26:51 2020        
(r368528)
@@ -382,8 +382,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to