From nobody Thu Mar 23 20:22:38 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 4PjGwt42L1z40HFB; Thu, 23 Mar 2023 20:22:38 +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 4PjGwt3MYsz424k; Thu, 23 Mar 2023 20:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679602958; 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=PT0gkJQiEv4bz5IWHbnrOMsMMQbPfx9SHfk1y4CchOM=; b=ocacWef8b9yfBLFuaXkQjpqpByqcVutodf5F4Rn7SWz1JRlVC0DiIRt/qAl3I2zcNTziOO wrRkGIJ0vJVMMBM2rVLwKheftzJCxzS3NStUbTPXlwT1j66w1ZAfjoSwf4svWNTVKAyhAD ky8ebOOiWYkDhnjHsJToPe5YdFYrn5v4/iF0cQBJ0gfHnvbjiM7XXSuPtGfKrXWQYLYa+C ETMwtcNRB9KhvjhThpO91R1lRQhREY+FKRXVCx3PkkK/s+lXr9Q381Kg1VjEhe3vfx0C6Y ZYKx1741OgI2K9AsUYYkdYpnvj43C9Be3w2SZhorrathBdxCV3kH+Lr+RTyJ/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679602958; 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=PT0gkJQiEv4bz5IWHbnrOMsMMQbPfx9SHfk1y4CchOM=; b=mIRa8x5iN9ZjtPbewOYv9edKltBsC6k15ISmk709VJyQCcJVKdVd0nPO1KER3ngp/wJu0q 5gBDVpFhOswYAI1JNai/E/WR8hvgdRxcuKZ7IiKc4P5RfMuuIJaptM80QOLrXJ4UyhcOrr Qw69cmx1GnSE1Cmi2+MqGlIlarzm+A26WVA50uul3grxDF/Nv+MKlgITQGTfrQP8NpqK/Y 0Wlc0cr+Hjnm4PAsGK0FxFVDM9slPut689b98w3WDhE8VtNtJPTjeXOV9GuFSeVQRm7PEy Tb5t8p42KaQkj/txWucCkyzsVG/M+cyaH7nVrxfNsAYELo3UBCRyJMST3MjG3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679602958; a=rsa-sha256; cv=none; b=a9GiPJoS3ixiI32tC8tx81wetjxShSWVrXr5LXsDrgSjN6XaT4cq3fphJ4iHTIKUjCmz9o ql/dH5UxCdYNonaoBVldwekIPceeSBe1ZjoMLsTWPJ/k+cz1i1KWrKMIthwIBaeG4uc77k f0s6UIGSoem7cZyewGgdey8xkvTfqerdQe8T8ztGMooOX8H3wILKOoqfAfZU4FPZSr9Hmw lx4760PhzHWVU3YEj6l1thCiyYW07wBa8A5Wz8WbH02PsR5E5yLEzM5D4HYkagPuNrFV33 eczk3VVSJH4M07pFOzFhJWpO8WNWedHGGtJXljJqzRib74WbhvN5dvJCrjyrQA== 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 4PjGwt2PXczqKZ; Thu, 23 Mar 2023 20:22:38 +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 32NKMcwK070627; Thu, 23 Mar 2023 20:22:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32NKMc1l070626; Thu, 23 Mar 2023 20:22:38 GMT (envelope-from git) Date: Thu, 23 Mar 2023 20:22:38 GMT Message-Id: <202303232022.32NKMc1l070626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 276e405a50d3 - releng/13.2 - 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/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 276e405a50d36229df308642b30e6e66372d39f2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.2 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=276e405a50d36229df308642b30e6e66372d39f2 commit 276e405a50d36229df308642b30e6e66372d39f2 Author: Mateusz Guzik AuthorDate: 2023-03-23 19:19:48 +0000 Commit: Mateusz Guzik CommitDate: 2023-03-23 20:22:20 +0000 vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups Reported by: Oliver Kiddle PR: 270419 MFC: 3 days Approved by: re (gjb) (cherry picked from commit c16c4ea6d399332d4a023df6e423be61fdb875a5) (cherry picked from commit 5d83656c09f522d6bf4f1050be60f270ddef04af) --- 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 e87f4a6cda1a..2b07dbbc34f0 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5075,6 +5075,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 @@ -5137,6 +5143,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));