Author: mjoras
Date: Mon Mar 19 22:43:27 2018
New Revision: 331227
URL: https://svnweb.freebsd.org/changeset/base/331227

Log:
  Fix initialization of eventhandler mutex.
  
  mtx_init does not do a copy of the name string it is passed. The
  eventhandler code incorrectly passed the parameter string directly to
  mtx_init instead of using the copy it makes. This was an existing
  problem with the code that I dutifully copied over in my changes in r325621.
  
  Reported by:  Anton Rang <rang AT acm.org>
  Reviewed by:  rstone, markj
  Approved by:  rstone (mentor)
  MFC after:    1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:        https://reviews.freebsd.org/D14764

Modified:
  head/sys/kern/subr_eventhandler.c

Modified: head/sys/kern/subr_eventhandler.c
==============================================================================
--- head/sys/kern/subr_eventhandler.c   Mon Mar 19 21:26:32 2018        
(r331226)
+++ head/sys/kern/subr_eventhandler.c   Mon Mar 19 22:43:27 2018        
(r331227)
@@ -90,9 +90,10 @@ eventhandler_find_or_create_list(const char *name)
                CTR2(KTR_EVH, "%s: creating list \"%s\"", __func__, name);
                list = new_list;
                TAILQ_INIT(&list->el_entries);
-               mtx_init(&list->el_lock, name, "eventhandler list", MTX_DEF);
                list->el_name = (char *)(list + 1);
                strcpy(list->el_name, name);
+               mtx_init(&list->el_lock, list->el_name, "eventhandler list",
+                   MTX_DEF);
                TAILQ_INSERT_HEAD(&eventhandler_lists, list, el_link);
            }
        }
_______________________________________________
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