Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2018 22:43:28 +0000 (UTC)
From:      Matt Joras <mjoras@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331227 - head/sys/kern
Message-ID:  <201803192243.w2JMhS6N079312@repo.freebsd.org>

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



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