|
|
b7d4d7 |
From b3647eb5415b2e3d9e1a11ad6c4689e520f17b39 Mon Sep 17 00:00:00 2001
|
|
|
b7d4d7 |
From: mohit84 <moagrawa@redhat.com>
|
|
|
b7d4d7 |
Date: Mon, 22 Feb 2021 10:09:34 +0530
|
|
|
b7d4d7 |
Subject: [PATCH 534/538] glusterd: Resolve use after free bug (#2181)
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
In the commit 61ae58e67567ea4de8f8efc6b70a9b1f8e0f1bea
|
|
|
b7d4d7 |
introduced a coverity bug use object after cleanup
|
|
|
b7d4d7 |
the object.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
Cleanup memory after comeout from a critical section
|
|
|
b7d4d7 |
>Fixes: #2180
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
>Change-Id: Iee2050c4883a0dd44b8523bb822b664462ab6041
|
|
|
b7d4d7 |
>Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
b7d4d7 |
Upstream Patch : https://github.com/gluster/glusterfs/pull/2181
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
BUG: 1832306
|
|
|
b7d4d7 |
Change-Id: Iee2050c4883a0dd44b8523bb822b664462ab6041
|
|
|
b7d4d7 |
Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
|
|
|
b7d4d7 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/228578
|
|
|
b7d4d7 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
b7d4d7 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
b7d4d7 |
---
|
|
|
b7d4d7 |
xlators/mgmt/glusterd/src/glusterd-utils.c | 5 ++---
|
|
|
b7d4d7 |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
index 9fb8eab..6d40be5 100644
|
|
|
b7d4d7 |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
@@ -122,11 +122,10 @@ glusterd_defrag_unref(glusterd_defrag_info_t *defrag)
|
|
|
b7d4d7 |
LOCK(&defrag->lock);
|
|
|
b7d4d7 |
{
|
|
|
b7d4d7 |
refcnt = --defrag->refcnt;
|
|
|
b7d4d7 |
- if (refcnt <= 0)
|
|
|
b7d4d7 |
- GF_FREE(defrag);
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
UNLOCK(&defrag->lock);
|
|
|
b7d4d7 |
-
|
|
|
b7d4d7 |
+ if (refcnt <= 0)
|
|
|
b7d4d7 |
+ GF_FREE(defrag);
|
|
|
b7d4d7 |
out:
|
|
|
b7d4d7 |
return refcnt;
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
--
|
|
|
b7d4d7 |
1.8.3.1
|
|
|
b7d4d7 |
|