summaryrefslogtreecommitdiffstats
path: root/rpc/xdr
diff options
context:
space:
mode:
authorBipin Kunal <bkunal@redhat.com>2016-06-07 17:59:27 +0530
committerNiels de Vos <ndevos@redhat.com>2016-06-07 15:24:10 -0700
commit8489fe576b6cf148fabcaeee79f298c41858133e (patch)
tree6253b448ab1b34f1e6811fbbccc4c3eab79e8606 /rpc/xdr
parentbdde0cfa1d5848e59d20c1adc19ee1b687eec66a (diff)
xdr/nfs: free complete groupnode structure
The groupnode->gr_next pointer is not traversed upon free. This is currently not a problem, because the pointer is never used. However the correct way to free a groupnode should check the ->gr_next pointer and free any of the groups that it encounters. This problem was identified while correcting a problem with the MOUNT protocol. The change "nfs: build exportlist with multiple groups" starts to use ->gr_next. Change-Id: I9d04eaf4c65bdb8db136321d60e70789da1739d7 BUG: 1343286 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14666 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: bipin kunal <kunalbipin@gmail.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'rpc/xdr')
-rw-r--r--rpc/xdr/src/xdr-nfs3.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/rpc/xdr/src/xdr-nfs3.c b/rpc/xdr/src/xdr-nfs3.c
index 0e145fc9954..01ccb236993 100644
--- a/rpc/xdr/src/xdr-nfs3.c
+++ b/rpc/xdr/src/xdr-nfs3.c
@@ -1836,6 +1836,19 @@ xdr_exportnode (XDR *xdrs, exportnode *objp)
return TRUE;
}
+static void
+xdr_free_groupnode (struct groupnode *group)
+{
+ if (!group)
+ return;
+
+ if (group->gr_next)
+ xdr_free_groupnode (group->gr_next);
+
+ GF_FREE (group->gr_name);
+ GF_FREE (group);
+}
+
void
xdr_free_exports_list (struct exportnode *first)
{
@@ -1848,10 +1861,7 @@ xdr_free_exports_list (struct exportnode *first)
elist = first->ex_next;
GF_FREE (first->ex_dir);
- if (first->ex_groups) {
- GF_FREE (first->ex_groups->gr_name);
- GF_FREE (first->ex_groups);
- }
+ xdr_free_groupnode (first->ex_groups);
GF_FREE (first);
first = elist;