Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1625643

Summary: Use CALLOC in dht_layouts_init
Product: [Community] GlusterFS Reporter: Nithya Balachandran <nbalacha>
Component: distributeAssignee: Nithya Balachandran <nbalacha>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-5.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-23 15:18:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nithya Balachandran 2018-09-05 12:30:08 UTC
Description of problem:

If dht_layouts_init fails, dht_init cleans it up by calling:

                if (conf->file_layouts) {                                       
                        for (i = 0; i < conf->subvolume_cnt; i++) {             
                                GF_FREE (conf->file_layouts[i]);                
                        }                                                       
                        GF_FREE (conf->file_layouts);                           
                } 

GF_FREE checks and frees non-null values. With malloc, we could end up with random non-null values in the buffer which GF_FREE will attempt to free.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Worker Ant 2018-09-05 12:56:25 UTC
REVIEW: https://review.gluster.org/21094 (cluster/dht: Initialise pointers to null) posted (#1) for review on master by N Balachandran

Comment 2 Worker Ant 2018-09-06 04:52:04 UTC
COMMIT: https://review.gluster.org/21094 committed in master by "N Balachandran" <nbalacha> with a commit message- cluster/dht: Initialise pointers to null

Use calloc in dht_layouts_init so to as to
prevent dht_init from attempting to free
invalid memory in case of failure.

There are other ways to do this (set first failure
to null and break there when cleaning up) but
I prefer having all pointers initialized to null.
This is a one time operation so it should not be
too expensive.

Change-Id: Ie22246047448f1cae971d48fa5aaf2efcaeb42c0
fixes: bz#1625643
Signed-off-by: N Balachandran <nbalacha>

Comment 3 Shyamsundar 2018-10-23 15:18:28 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.0, please open a new bug report.

glusterfs-5.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2018-October/000115.html
[2] https://www.gluster.org/pipermail/gluster-users/