cluster: RHEL5 - clogd: Initialize list structs before adding to list.

Jonathan Brassow jbrassow@fedoraproject.org
Wed Feb 11 15:57:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=948e49365049e7540d5c5702c1885ff8f1887619
Commit:        948e49365049e7540d5c5702c1885ff8f1887619
Parent:        864eb5eb988f9036759f58d651754ec0831675d5
Author:        Jonathan Brassow <jbrassow@redhat.com>
AuthorDate:    Wed Feb 11 09:56:28 2009 -0600
Committer:     Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Wed Feb 11 09:56:28 2009 -0600

clogd: Initialize list structs before adding to list.

If we don't initialize newly allocated list structures,
we can corrupt the working linked list.
---
 cmirror/src/cluster.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/cmirror/src/cluster.c b/cmirror/src/cluster.c
index 483ed1d..7711b28 100644
--- a/cmirror/src/cluster.c
+++ b/cmirror/src/cluster.c
@@ -927,6 +927,7 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
 			return;
 		}
 		memcpy(tmp_tfr, tfr, sizeof(*tfr) + tfr->data_size);
+		INIT_LIST_HEAD((struct list_head *)&tmp_tfr->private);
 		list_add_tail((struct list_head *)&tmp_tfr->private, &match->working_list);
 	}
 
@@ -1023,6 +1024,7 @@ static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
 
 			memcpy(tmp_tfr, tfr, sizeof(*tfr) + tfr->data_size);
 			tmp_tfr->error = match->lowest_id;
+			INIT_LIST_HEAD((struct list_head *)&tmp_tfr->private);
 			list_add_tail((struct list_head *)&tmp_tfr->private,
 				      &match->startup_list);
 			goto out;
@@ -1146,6 +1148,7 @@ static void cpg_join_callback(struct clog_cpg *match,
 	}
 	tfr->request_type = DM_CLOG_MEMBER_JOIN;
 	tfr->originator   = joined->nodeid;
+	INIT_LIST_HEAD((struct list_head *)&tfr->private);
 	list_add_tail((struct list_head *)&tfr->private, &match->startup_list);
 
 out:



More information about the Cluster-cvs mailing list