The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1319c433f4e5d67f8ea6fd2369c604069f733c94

commit 1319c433f4e5d67f8ea6fd2369c604069f733c94
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-12-28 13:41:30 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2022-01-08 03:41:44 +0000

    msdosfs: handle a case when non-dot lookup returned dvp
    
    This means that filesystem is corrupted, there is a loop.
    
    In collaboration with:  pho
    Reviewed by:    markj, mckusick
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D33721
---
 sys/fs/msdosfs/msdosfs_lookup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
index d9b52539e602..38bded459692 100644
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -573,6 +573,10 @@ foundroot:
                        goto restart;
                }
        } else if (dp->de_StartCluster == scn && isadir) {
+               if (cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.') {
+                       /* fs is corrupted, non-dot lookup returned dvp */
+                       return (EBADF);
+               }
                VREF(vdp);      /* we want ourself, ie "." */
                *vpp = vdp;
        } else {

Reply via email to