[lvm-devel] [PATCHv2 1/4] dmeventd: Fix segfault in _timeout_thread

Marian Csontos mcsontos at redhat.com
Tue Sep 22 11:16:07 UTC 2015


In case thread was found or thread registration failed after
_register_for_timeout, thread_status was kept in timeout_list after
deallocation.
---
This should be the actual fix for the above mentioned BZ 1210514 and BZ 1220856.

*TODO* Any ideas how to test this? Is explicitly messaging dmeventd required?

 daemons/dmeventd/dmeventd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 1ff5bf9..0f67206 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1081,6 +1081,7 @@ static int _register_for_event(struct message_data *message_data)
 		if ((ret = -_create_thread(thread))) {
 			_unlock_mutex();
 			_do_unregister_device(thread);
+			_unregister_for_timeout(thread);
 			_free_thread_status(thread);
 			goto out;
 		}
@@ -1097,8 +1098,10 @@ static int _register_for_event(struct message_data *message_data)
 	 * Deallocate thread status after releasing
 	 * the lock in case we haven't used it.
 	 */
-	if (thread_new)
+	if (thread_new) {
+		_unregister_for_timeout(thread);
 		_free_thread_status(thread_new);
+	}
 
 	return ret;
 }
-- 
1.8.3.1




More information about the lvm-devel mailing list