From nobody Thu Mar 23 19:31:33 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PjFny20L7z41jDH; Thu, 23 Mar 2023 19:31:34 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PjFny1VtCz3tbT; Thu, 23 Mar 2023 19:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679599894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1e6O4hkVV+cbnSG891vq+qbFGz6uIBTpFbb79TpOctU=; b=HmMTQwaX1BLV7lFtaKo9xtgg7bMep94lLifI0DDpDM/zGz/qJ/hzf9/oehR8RWBY4SdYVR dG8PoNMfk8RvXfKmcNsiHDU34kU2ER8AzOGog8tuiOMsN/bcWRtlo4qCCXhd0zAoUjAype Rr1iV9bvo9U6PLg+HekeUsnBZumglxe7mbYZAlEM29h2OD01q8tthQAfLbmL1pvaLNLdmA /5vIC3KwDLHbFRUzRJLK7FiKtdp4BjhwtZD69PB1hL2KacTvvvYxPvpEfNTa3XVTNsnoXZ qBWTVH9AqNw0ruXNku9VEiA6YSKaRhmHt43e5423e69yvCqMc6cBir0zbUa51w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679599894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1e6O4hkVV+cbnSG891vq+qbFGz6uIBTpFbb79TpOctU=; b=Co00whujNp7GN08lZBnfJcOoUTpsURrgOqMzyLv5IvlB5aCwKbMvc49BJFAoQSf57fMB9f QQP4xAnxSJJDFni1tVDAQR1fXcEXzbvuFvF9VDNlIKARMzTXPQEfQ8UjpD2/g4f53jiRF8 E8AoEn6Qx63Vu7pf1ZdnJxPuy5AKX5pQlB0nXi3b8uqSUTf40E7cjFV6luyWZpUA5nBRnx P2mveqgvib9mXaSTNJhrFxCvQcdJb6vM3ZCji9FycEvq6/fvswunn84Bkabm022hPVq7Fb +w3evCEsmDgR9pPEfZeyHVCdaaF5v7j+i0/I0vn80rf9JDzB99ARQ2oSmBT+sA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679599894; a=rsa-sha256; cv=none; b=MmUBRf1uKww3JM43mphCBJmVsXpg94WYWd5bV5IFzQ5ycA04aiH8BPDRoSWTlt+UPvmCgl dGmFrKuwSFsKqJbl0SOYewdqxzhu5bajl+HXn5UWpRESanPTVlC+yNLV1pYiZThl9ucYis t1z6gr/BGWcl6GQuUgPL8SBBKVXhrQMaHOXiV4YDGtHJMDkKD7h9UUZSI6FS9sZb+V3bIt e3UDvXZzShcCa7Zd67HKXRlpUBg7BJUUkaKs4T6r7STPDLUdhdjy9KAO2dE8/Y13VflyRp PWxbV9a0oR9ddaB5dlFav0C1mJK7HBZC7vsr5USQDgDKC92g+Bd5kkMwMTcbRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PjFny0YwFzp13; Thu, 23 Mar 2023 19:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32NJVXOF083771; Thu, 23 Mar 2023 19:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NJVXqM083756; Thu, 23 Mar 2023 19:31:33 GMT (envelope-from git) Date: Thu, 23 Mar 2023 19:31:33 GMT Message-Id: <202303231931.32NJVXqM083756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c16c4ea6d399 - main - vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c16c4ea6d399332d4a023df6e423be61fdb875a5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c16c4ea6d399332d4a023df6e423be61fdb875a5 commit c16c4ea6d399332d4a023df6e423be61fdb875a5 Author: Mateusz Guzik AuthorDate: 2023-03-23 19:19:48 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-23 19:31:18 +0000 vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups Reported by: Oliver Kiddle PR: 270419 MFC: 3 days --- sys/kern/vfs_cache.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3ae2b663fffb..e716113e6085 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5065,6 +5065,12 @@ cache_fplookup_dot(struct cache_fpl *fpl) int error; MPASS(!seqc_in_modify(fpl->dvp_seqc)); + + if (__predict_false(fpl->dvp->v_type != VDIR)) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + /* * Just re-assign the value. seqc will be checked later for the first * non-dot path component in line and/or before deciding to return the @@ -5127,6 +5133,11 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } + if (__predict_false(dvp->v_type != VDIR)) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + ncp = atomic_load_consume_ptr(&dvp->v_cache_dd); if (ncp == NULL) { return (cache_fpl_aborted(fpl));