Bug 72890
| Summary: | File descriptor leak in mount nfs code | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | James Antill <james.antill> |
| Component: | autofs | Assignee: | Jeff Moyer <jmoyer> |
| Status: | CLOSED NEXTRELEASE | QA Contact: | Brock Organ <borgan> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.3 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2006-04-05 14:05:50 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Just in case bugzilla mangles it I've mirrored the patch at... http://www.and.org/patches/autofs-3.1.7_fd-leak.patch This fix will appear in RHEL 3 U3 and AS2.1 U5. Rawhide now uses autofs4, which already has this bugfix. |
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);