Bug 72890 - File descriptor leak in mount nfs code
File descriptor leak in mount nfs code
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: autofs (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeffrey Moyer
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-08-28 15:53 EDT by James Antill
Modified: 2007-04-18 12:46 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-05 10:05:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Antill 2002-08-28 15:53:57 EDT
Description of Problem:
 When mounting NFS mounts autofs will check to see if the mount is local by
trying to connect to the UDP discard port and comparing IP addresses. If the
connect() call fails autofs leaks the socket for the test.

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

How Reproducible:
 Always.

Steps to Reproduce:
1. disable UDP discard
2. put a local NFS mount in autofs map file.
3. see fd leaks, and slow performance because it'll use a local NFS mount
instead of a bind mount.

Actual Results:


Expected Results:


Additional Information:

 Here is a patch.

diff -ru autofs-3.1.7-orig/modules/mount_nfs.c autofs-3.1.7/modules/mount_nfs.c
--- autofs-3.1.7-orig/modules/mount_nfs.c	Sat Nov  4 02:05:17 2000
+++ autofs-3.1.7/modules/mount_nfs.c	Wed Aug 28 15:47:38 2002
@@ -123,9 +123,11 @@
 	
 	len = sizeof(laddr);
 	
-
if ( connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0 )
+
if ( connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0 ) {
+
  close(sock);
 	  continue;		/* Assume it wasn't local */
-

+
}
+
 	if ( getsockname(sock, (struct sockaddr *) &laddr, &len) < 0 ) {
 	  syslog(LOG_ERR, MODPREFIX "getsockname failed for %s: %m", name);
 	  close(sock);
Comment 1 James Antill 2002-08-28 16:10:27 EDT
 Just in case bugzilla mangles it I've mirrored the patch at...

http://www.and.org/patches/autofs-3.1.7_fd-leak.patch
Comment 2 Jeffrey Moyer 2004-03-22 10:26:46 EST
This fix will appear in RHEL 3 U3 and AS2.1 U5.  Rawhide now uses
autofs4, which already has this bugfix.

Note You need to log in before you can comment on or make changes to this bug.