[OpenAFS-devel] (rare) Linux kernel memory leak on not freeing temporary name

Rainer Toebbicke rtb@pclella.cern.ch
Thu, 22 Feb 2007 17:46:06 +0100


This is a multi-part message in MIME format.
--------------050404000505030002090503
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

When a file is being removed while open and hence temporarily renamed 
to .__afsXXX, the space allocated for the temporary name will not be 
freed should the rename fail.

Should be rare, the usual checks involved in the "rm" prevent the most 
obvious scenarios from happening, thus I have been unable to actually 
provoke this. Perhaps suitably expiring tokens or an exotic ACL would 
do, a network cut at the right moment would certainly help.

But anyway the case that the rename fails should be dealt with properly.

Patch attached, bcc to openafs-bugs.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------050404000505030002090503
Content-Type: text/plain;
 name="p_rm_leak"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="p_rm_leak"

--- openafs/src/afs/LINUX/osi_vnodeops.c        2006-05-09 16:30:58.000000000 +0200
+++ openafs/src/afs/LINUX/osi_vnodeops.c        2007-02-02 15:26:01.000000000 +0100
@@ -1205,6 +1213,8 @@
             }
             tvc->uncred = credp;
 	    tvc->states |= CUnlinked;
+	} else {
+	    osi_FreeSmallSpace(__name);
 	}
 	AFS_GUNLOCK();
 

--------------050404000505030002090503--