freebsd-dev/sbin/fsck_msdosfs
Xin LI 890cae1977 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.

Reported by:	NetApp (kevans@)
Reviewed by:	kevans, emaste (no objection)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D32699
2021-11-03 22:09:32 -07:00
..
boot.c
check.c Do not overflow when calculating file system size. 2020-04-28 05:10:34 +00:00
dir.c fsck_msdosfs: truncate directory entry when the head pointer is invalid. 2021-11-03 22:09:32 -07:00
dosfs.h
ext.h
fat.c
fsck_msdosfs.8
main.c
Makefile
Makefile.depend