git: sbin/fsck_msdosfs: truncate directory entry when the head pointer is invalid.

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Tue Nov 9 10:19:37 PST 2021


commit 1351cfd71b069b3338915f3ac9908051ac283d6f
Author: Tomohiro Kusumi <tkusumi at netbsd.org>
Date:   Wed Nov 10 01:12:26 2021 +0900

    sbin/fsck_msdosfs: truncate directory entry when the head pointer is invalid.
    
    As far as we know, there is no FAT implementation that supported hard
    links, and our msdosfs driver assumed one cluster chain is only
    referenced by one directory entry and clears it out when the file is
    deleted.  On the other hand, the current code would proceed with
    checkchain() when the directory entry's head cluster is a valid numbered
    cluster without checking if it was a valid head node of a cluster chain.
    
    So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD),
    or was already referenced by another directory entry, this would
    trigger an assertion in check_chain() at a later time.
    
    Fix this by giving the user an option to truncate the directory entry
    when the head cluster is an invalid cluster, an visited head node,
    or not a head node.
    
    taken from FreeBSD 890cae197737b463e56d1cc5a3f61f84cb49c807

Summary of changes:
 sbin/fsck_msdosfs/dir.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/1351cfd71b069b3338915f3ac9908051ac283d6f


-- 
DragonFly BSD source repository



More information about the Commits mailing list