Bug 684017

Summary: memory leak in quota-3.17-64-bit-quota-support.patch
Product: Red Hat Enterprise Linux 6 Reporter: Kamil Dudka <kdudka>
Component: quotaAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.1CC: fnadge, mcermak, ovasik
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://sourceforge.net/tracker/?func=detail&aid=3206267&group_id=18136&atid=118136
Whiteboard:
Fixed In Version: quota-3.17-15.el6 Doc Type: Bug Fix
Doc Text:
Cause Processing vsfv1 quota file by quota tools (quota, quotacheck) on file system with disabled quota enforcing caused memory leaks. Consequence Processing huge vfsv1 quota file or handling RPC queries on vfsv1 file system with disabled quota enforcing by rpc.rquotad repeatedly for long time period could consume lot of physical memory. Fix When processing vfsv1 quota file, memory is freed properly once it's not needed anymore. Result No memory leaks occur.
Story Points: ---
Clone Of:
: 684189 (view as bug list) Environment:
Last Closed: 2011-05-19 14:10:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Fix ddquot buffer leak none

Description Kamil Dudka 2011-03-10 22:10:50 UTC
Description of problem:
qtree_read_dquot() calls smalloc(info->dqi_entry_size) to allocate memory that is never freed afterwards.


Version-Release number of selected component (if applicable):
quota-3.17-14.el6

Comment 4 Petr Pisar 2011-03-11 09:56:18 UTC
You are right. The ddquot buffer is allocated, under a condition filled by data and its content parsed and copied into dquot, and then the function exits. So the ddquot buffer should be freed before return.

Upstream development version is affected too.

Comment 5 Petr Pisar 2011-03-11 10:01:28 UTC
The same bug is in qtree_write_dquot() in the same file.

Comment 6 Petr Pisar 2011-03-11 10:20:34 UTC
Reported to upstream with a proposed fix.

Comment 7 Kamil Dudka 2011-03-11 10:48:23 UTC
(In reply to comment #5)
> The same bug is in qtree_write_dquot() in the same file.

You are right.  Neither v2r0_mem2diskdqblk(), nor v2r1_mem2diskdqblk() frees the allocated memory.

Comment 8 Petr Pisar 2011-03-11 11:49:18 UTC
Created attachment 483694 [details]
Fix ddquot buffer leak

Fix submitted to upstream, it applies to RHEL-6 version cleanly, leaks in both functions are covered.

Comment 11 Florian Nadge 2011-03-30 14:24:12 UTC
Hi,
I am reviewing and editing erratum:
http://errata.devel.redhat.com/errata/stateview/10703
and would need some more details for this bug to state all the necessary points.

Could you give a few key words to the points I pasted into the Technical Notes field. Once I have the text I can start on the approval process. 

Thanks

Comment 12 Florian Nadge 2011-03-30 14:24:12 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    What actions or circumstances cause this bug to present.
Consequence
    What happens when the bug presents.
Fix
    What was done to fix the bug.
Result
    What now happens when the actions or circumstances above occur.
    Note: this is not the same as the bug doesn’t present anymore.

Comment 14 Petr Pisar 2011-03-31 09:01:30 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,9 +1,14 @@
 Cause
-    What actions or circumstances cause this bug to present.
+    Processing vsfv1 quota file by quota tools (quota,
+    quotacheck) on file system with disabled quota
+    enforcing caused memory leaks.
 Consequence
-    What happens when the bug presents.
+    Processing huge vfsv1 quota file or handling RPC
+    queries on vfsv1 file system with disabled quota
+    enforcing by rpc.rquotad repeatedly for long time
+    period could consume lot of physical memory.
 Fix
-    What was done to fix the bug.
+    When processing vfsv1 quota file, memory is freed
+    properly once it's not needed anymore.
 Result
-    What now happens when the actions or circumstances above occur.
+    No memory leaks occur.-    Note: this is not the same as the bug doesn’t present anymore.

Comment 15 errata-xmlrpc 2011-05-19 14:10:09 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0716.html