From owner-svn-src-head@freebsd.org Fri Oct 6 09:02:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 750F5E31641; Fri, 6 Oct 2017 09:02:37 +0000 (UTC) (envelope-from manu@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 mx1.freebsd.org (Postfix) with ESMTPS id 3FF3B7646E; Fri, 6 Oct 2017 09:02:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9692aUA063732; Fri, 6 Oct 2017 09:02:36 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9692aMa063731; Fri, 6 Oct 2017 09:02:36 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201710060902.v9692aMa063731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 6 Oct 2017 09:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324353 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2017 09:02:37 -0000 Author: manu Date: Fri Oct 6 09:02:36 2017 New Revision: 324353 URL: https://svnweb.freebsd.org/changeset/base/324353 Log: vfs_export_lookup: Fix r324054 When using the default address list nam is still valid, the code in r324054 assumed that is was NULL. Reported by: Guy Yur Tested by: Guy Yur Modified: head/sys/kern/vfs_export.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Fri Oct 6 08:49:15 2017 (r324352) +++ head/sys/kern/vfs_export.c Fri Oct 6 09:02:36 2017 (r324353) @@ -459,34 +459,33 @@ vfs_export_lookup(struct mount *mp, struct sockaddr *n return (NULL); /* - * If no address is provided, use the default if it exists. + * Lookup in the export list */ - if (nam == NULL) { - if ((mp->mnt_flag & MNT_DEFEXPORTED) != 0) - return (&nep->ne_defexported); - return (NULL); + if (nam != NULL) { + saddr = nam; + rnh = NULL; + switch (saddr->sa_family) { + case AF_INET: + rnh = nep->ne4; + break; + case AF_INET6: + rnh = nep->ne6; + break; + } + if (rnh != NULL) { + RADIX_NODE_HEAD_RLOCK(rnh); + np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, &rnh->rh); + RADIX_NODE_HEAD_RUNLOCK(rnh); + if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0) + return (NULL); + } } /* - * Lookup in the export list + * If no address match, use the default if it exists. */ - saddr = nam; - rnh = NULL; - switch (saddr->sa_family) { - case AF_INET: - rnh = nep->ne4; - break; - case AF_INET6: - rnh = nep->ne6; - break; - } - if (rnh != NULL) { - RADIX_NODE_HEAD_RLOCK(rnh); - np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, &rnh->rh); - RADIX_NODE_HEAD_RUNLOCK(rnh); - if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0) - return (NULL); - } + if (np == NULL && (mp->mnt_flag & MNT_DEFEXPORTED) != 0) + return (&nep->ne_defexported); return (np); }