From: Hannes Reinecke Date: Fri, 18 Feb 2011 08:34:18 +0000 (+0100) Subject: multipathd: crash in reconfigure CLI command X-Git-Tag: upstream/0.5.0~106^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e7b4d8d6fa8dc9433c1e60d4bd6717aec2f5296;p=platform%2Fupstream%2Fmultipath-tools.git multipathd: crash in reconfigure CLI command The 'reconfigure' CLI command doesn't take the vector lock, so if multipathd is processing a table / udev event at the same time it'll crash. Signed-off-by: Hannes Reinecke --- diff --git a/multipathd/main.c b/multipathd/main.c index 6867f23..ffde5be 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1257,7 +1257,9 @@ int reconfigure (struct vectors * vecs) { struct config * old = conf; + int retval = 1; + lock(vecs->lock); /* * free old map and path vectors ... they use old conf state */ @@ -1270,19 +1272,16 @@ reconfigure (struct vectors * vecs) vecs->pathvec = NULL; conf = NULL; - if (load_config(DEFAULT_CONFIGFILE)) - return 1; - - conf->verbosity = old->verbosity; - - if (!conf->checkint) { - conf->checkint = DEFAULT_CHECKINT; - conf->max_checkint = MAX_CHECKINT(conf->checkint); + if (!load_config(DEFAULT_CONFIGFILE)) { + conf->verbosity = old->verbosity; + conf->daemon = 1; + configure(vecs, 1); + free_config(old); + retval = 0; } - conf->daemon = 1; - configure(vecs, 1); - free_config(old); - return 0; + + unlock(vecs->lock); + return retval; } static struct vectors * @@ -1336,9 +1335,7 @@ sighup (int sig) { condlog(2, "reconfigure (SIGHUP)"); - lock(gvecs->lock); reconfigure(gvecs); - unlock(gvecs->lock); #ifdef _DEBUG_ dbg_free_final(NULL);