From owner-svn-src-projects@freebsd.org Sat May 16 02:34:57 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 563192E10F6 for ; Sat, 16 May 2020 02:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49P8WP1Z7lz3HlV; Sat, 16 May 2020 02:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 312CC6A6A; Sat, 16 May 2020 02:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04G2YvgK099464; Sat, 16 May 2020 02:34:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04G2Yv1t099463; Sat, 16 May 2020 02:34:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202005160234.04G2Yv1t099463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 16 May 2020 02:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r361100 - projects/nfs-over-tls/sys/rpc/rpcsec_tls X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfs-over-tls/sys/rpc/rpcsec_tls X-SVN-Commit-Revision: 361100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2020 02:34:57 -0000 Author: rmacklem Date: Sat May 16 02:34:56 2020 New Revision: 361100 URL: https://svnweb.freebsd.org/changeset/base/361100 Log: Add fdrop()s to the rpctls syscall for the "fp" reference. Without these fdrop()s, the daemons leaked file descriptors and it also left closed TCP sockets lying around. I didn't realize that falloc() returns with two references, one for the "fd" and one for the "fp". Modified: projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c Modified: projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c ============================================================================== --- projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c Sat May 16 02:29:10 2020 (r361099) +++ projects/nfs-over-tls/sys/rpc/rpcsec_tls/rpctls_impl.c Sat May 16 02:34:56 2020 (r361100) @@ -240,6 +240,7 @@ printf("falloc=%d fd=%d\n", error, fd); rpctls_connect_so = NULL; mtx_unlock(&rpctls_connect_lock); finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); + fdrop(fp, td); /* Drop fp reference. */ td->td_retval[0] = fd; } printf("returning=%d\n", fd); @@ -260,6 +261,7 @@ printf("srv falloc=%d fd=%d\n", error, fd); rpctls_server_so = NULL; mtx_unlock(&rpctls_server_lock); finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); + fdrop(fp, td); /* Drop fp reference. */ td->td_retval[0] = fd; } printf("srv returning=%d\n", fd);