]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
cache: only assert on flags when dealing with EMPTYPATH
authorMateusz Guzik <mjg@FreeBSD.org>
Sun, 17 Oct 2021 08:40:16 +0000 (10:40 +0200)
committerMateusz Guzik <mjg@FreeBSD.org>
Sat, 5 Mar 2022 19:52:33 +0000 (19:52 +0000)
Reported by: syzbot+bd48ee0843206a09e6b8@syzkaller.appspotmail.com
Fixes: 7dd419cabc6bb9e0 ("cache: add empty path support")

(cherry picked from commit 1045352f150346ba422b3a3ce6344fc694bc3aa4)

sys/kern/vfs_cache.c

index 313879cf6d1f21edecab29125f29cd1402e1465c..14e148b2f839b29288fbde7a7ac94e97306534bd 100644 (file)
@@ -4784,13 +4784,14 @@ cache_fplookup_emptypath(struct cache_fpl *fpl)
        tvp_seqc = fpl->tvp_seqc;
 
        MPASS(*cnp->cn_pnbuf == '\0');
-       MPASS((cnp->cn_flags & (LOCKPARENT | WANTPARENT)) == 0);
 
        if (__predict_false((cnp->cn_flags & EMPTYPATH) == 0)) {
                cache_fpl_smr_exit(fpl);
                return (cache_fpl_handled_error(fpl, ENOENT));
        }
 
+       MPASS((cnp->cn_flags & (LOCKPARENT | WANTPARENT)) == 0);
+
        tvs = vget_prep_smr(tvp);
        cache_fpl_smr_exit(fpl);
        if (__predict_false(tvs == VGET_NONE)) {