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
This commit is contained in:
mjoras 2018-03-19 22:43:27 +00:00
parent 58e1b5421f
commit 7854cb198f

View File

@ -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);
}
}