From 45456abc4ce71053d07cf03ca63bd1ce459fec55 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 2 Feb 2021 18:06:56 +0000 Subject: [PATCH] cache: fix trailing slash support in face of permission problems Reported by: Johan Hendriks Tested by: kevans --- sys/kern/vfs_cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7f0e59f1a1e..db482ea4eba 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5521,6 +5521,16 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; + /* + * TODO: Due to ignoring slashes lookup will perform a permission check + * on the last dir when it should not have. If it fails, we get here. + * It is possible possible to fix it up fully without resorting to + * regular lookup, but for now just abort. + */ + if (cache_fpl_istrailingslash(fpl)) { + return (cache_fpl_aborted(fpl)); + } + /* * Hack: delayed degenerate path checking. */