summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2019-06-25 18:00:06 +0200
committerMOHIT AGRAWAL <moagrawa@redhat.com>2019-09-15 06:32:20 +0000
commit9a26cbd7e53297f9321b4f1cfed415db7bb75d09 (patch)
tree18c3ddc65bfcc0edf0a9d4dc890afc6392fe9549
parent072f31bea74d9321a0a71c070265f15d4104f086 (diff)
glusterd: fix use-after-free of a dict_t
A dict was passed to a function that calls dict_unref() without taking any additional reference. Given that the same dict is also used after the function returns, this was causing a use-after-free situation. To fix the issue, we simply take an additional reference before calling the function. > Fixes: bz#1723890 > Change-Id: I98c6b76b08fe3fa6224edf281a26e9ba1ffe3017 > Signed-off-by: Xavi Hernandez <xhernandez@redhat.com> > (cherry picked from commit f36086db87aae24c10abde434f081d78b942735e) Fixes: bz#1752245 Change-Id: I98c6b76b08fe3fa6224edf281a26e9ba1ffe3017 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7cf86f96429..5b84a3e6772 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3510,7 +3510,7 @@ glusterd_add_volumes_to_export_dict(dict_t *peer_data, char **buf,
if (totthread) {
gf_log(this->name, GF_LOG_INFO,
"Finished merger of all dictionraies into single one");
- dict_arr[totthread++] = peer_data;
+ dict_arr[totthread++] = dict_ref(peer_data);
ret = glusterd_dict_arr_serialize(dict_arr, totthread, buf, length);
gf_log(this->name, GF_LOG_INFO,
"Serialize dictionary data return is %d", ret);