|
 |
1f016a |
commit cbdcd47aa56dd4a1ad369b1fa403588261421f33
|
|
 |
1f016a |
Author: Andrew Beekhof <andrew@beekhof.net>
|
|
 |
1f016a |
Date: Thu Jan 15 14:11:45 2015 +1100
|
|
 |
1f016a |
|
|
 |
1f016a |
Fix: crm_resource: Use-after-free when restarting a resource
|
|
 |
1f016a |
|
|
 |
1f016a |
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
|
 |
1f016a |
index 968683a..3cb3fc3 100644
|
|
 |
1f016a |
--- a/tools/crm_resource.c
|
|
 |
1f016a |
+++ b/tools/crm_resource.c
|
|
 |
1f016a |
@@ -1415,6 +1415,9 @@ update_dataset(cib_t *cib, pe_working_set_t * data_set, bool simulate)
|
|
 |
1f016a |
goto cleanup;
|
|
 |
1f016a |
}
|
|
 |
1f016a |
|
|
 |
1f016a |
+ if(data_set->input) {
|
|
 |
1f016a |
+ free_xml(data_set->input);
|
|
 |
1f016a |
+ }
|
|
 |
1f016a |
set_working_set_defaults(data_set);
|
|
 |
1f016a |
data_set->input = cib_xml_copy;
|
|
 |
1f016a |
data_set->now = crm_time_new(NULL);
|
|
 |
1f016a |
@@ -1452,8 +1455,8 @@ update_dataset(cib_t *cib, pe_working_set_t * data_set, bool simulate)
|
|
 |
1f016a |
}
|
|
 |
1f016a |
|
|
 |
1f016a |
cleanup:
|
|
 |
1f016a |
+ /* Do not free 'cib_xml_copy' here, we need rsc->xml to be valid later on */
|
|
 |
1f016a |
cib_delete(shadow_cib);
|
|
 |
1f016a |
- free_xml(cib_xml_copy);
|
|
 |
1f016a |
free(pid);
|
|
 |
1f016a |
|
|
 |
1f016a |
if(shadow_file) {
|
|
 |
1f016a |
@@ -1782,7 +1785,7 @@ static struct crm_option long_options[] = {
|
|
 |
1f016a |
{"-spacer-", 1, 0, '-', "\nAdvanced Commands:"},
|
|
 |
1f016a |
{"delete", 0, 0, 'D', "\t\t(Advanced) Delete a resource from the CIB"},
|
|
 |
1f016a |
{"fail", 0, 0, 'F', "\t\t(Advanced) Tell the cluster this resource has failed"},
|
|
 |
1f016a |
- {"restart", 0, 0, 0, NULL, 1},
|
|
 |
1f016a |
+ {"restart", 0, 0, 0, "\t\t(Advanced) Tell the cluster to restart this resource and anything that depends on it"},
|
|
 |
1f016a |
{"force-stop", 0, 0, 0, "\t(Advanced) Bypass the cluster and stop a resource on the local node. Additional detail with -V"},
|
|
 |
1f016a |
{"force-start",0, 0, 0, "\t(Advanced) Bypass the cluster and start a resource on the local node. Additional detail with -V"},
|
|
 |
1f016a |
{"force-check",0, 0, 0, "\t(Advanced) Bypass the cluster and check the state of a resource on the local node. Additional detail with -V\n"},
|