diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-12-21 13:03:06 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-12-21 13:03:06 +0000 |
commit | 169470b621322ba225c8b01ea6eda664aaf16add (patch) | |
tree | e722992ba6268770e0dd6433e09863f19f83ea31 | |
parent | d3b4a0f322cbfaa5b808e6654e2a3caf6c87986e (diff) | |
download | lvm2-169470b621322ba225c8b01ea6eda664aaf16add.tar.gz lvm2-169470b621322ba225c8b01ea6eda664aaf16add.tar.xz lvm2-169470b621322ba225c8b01ea6eda664aaf16add.zip |
Fix missing thread list manipulation
For manipulation with thread list to avoid race with timeout thread,
take also _timeout_mutex.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | daemons/dmeventd/dmeventd.c | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Fix missing thread list manipulation protection in dmeventd. Do not derefence lv pointer in _percent_run() function before NULL check. Allow empty strings for description and creation_host config fields. Issue deprecation warning when removing last lvm1-format snapshot. diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index 027c2e13..b26faf85 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -739,8 +739,10 @@ static void _monitor_unregister(void *arg) return; } thread->status = DM_THREAD_DONE; + pthread_mutex_lock(&_timeout_mutex); UNLINK_THREAD(thread); LINK(thread, &_thread_registry_unused); + pthread_mutex_unlock(&_timeout_mutex); _unlock_mutex(); } @@ -1078,8 +1080,10 @@ static int _unregister_for_event(struct message_data *message_data) * unlink and terminate its monitoring thread. */ if (!thread->events) { + pthread_mutex_lock(&_timeout_mutex); UNLINK_THREAD(thread); LINK(thread, &_thread_registry_unused); + pthread_mutex_unlock(&_timeout_mutex); } _unlock_mutex(); |