From: Christophe Varoqui Date: Fri, 28 Oct 2005 08:05:26 +0000 (+0200) Subject: [multipathd] fix stop_waiter_thread() segv X-Git-Tag: 0.4.6~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9e67ad4fe0837f5946b1c29c9c7b8da259955d5;p=platform%2Fupstream%2Fmultipath-tools.git [multipathd] fix stop_waiter_thread() segv This happened when asked to shut a waiter for a map with NULL mpp->waiter. A code path from dm_get_maps -> setup_multipath (fails) can trigger that. --- diff --git a/multipathd/main.c b/multipathd/main.c index e56f672..bc4c1be 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -111,11 +111,18 @@ static void stop_waiter_thread (struct multipath * mpp, struct vectors * vecs) { struct event_thread * wp = (struct event_thread *)mpp->waiter; - pthread_t thread = wp->thread; - - if (!wp) + pthread_t thread; + + if (!wp) { + condlog(3, "%s: no waiter thread", mpp->alias); return; + } + wp = wp->thread; + if (!wp) { + condlog(3, "%s: thread not started", mpp->alias); + return; + } condlog(2, "%s: stop event checker thread", wp->mapname); pthread_kill(thread, SIGHUP); } @@ -725,7 +732,7 @@ uev_remove_map (char * devname, struct vectors * vecs) if (!mpp) { condlog(3, "%s: devmap not registered, can't remove", devname); - return 1; + return 0; } condlog(2, "remove %s devmap", mpp->alias);