Bug 72890 - File descriptor leak in mount nfs code
Summary: File descriptor leak in mount nfs code
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: autofs
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Moyer
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-08-28 19:53 UTC by James Antill
Modified: 2007-04-18 16:46 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-04-05 14:05:50 UTC
Embargoed:


Attachments (Terms of Use)

Description James Antill 2002-08-28 19:53:57 UTC
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 20:10:27 UTC
 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 Jeff Moyer 2004-03-22 15:26:46 UTC
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.