freebsd-nq/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 Diff reduction against NetBSD, no functional change. 2020-02-02 20:53:31 +00:00
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 Reduce memory footprint of fsck_msdosfs. 2020-01-03 00:31:48 +00:00
ext.h Fix a bug with dirty file system handling. 2020-04-27 02:01:48 +00:00
fat.c Fix a bug with dirty file system handling. 2020-04-27 02:01:48 +00:00
fsck_msdosfs.8 fsck_msdosfs.8: document -M. 2020-01-07 04:33:14 +00:00
main.c Reduce memory footprint of fsck_msdosfs. 2020-01-03 00:31:48 +00:00
Makefile Use humanize_number to format available and bad space sizes. 2020-02-10 04:16:41 +00:00
Makefile.depend