Files
u-boot/fs/fat/Kconfig
Varadarajan Narayanan 5e7b138490 fs: fat: Handle 'FAT sector size mismatch'
The disk_read() and disk_write() functions of the FAT driver use the
blk_dread() and blk_dwrite() respectively. The blk_* APIs read and write
to the devices in terms of the device block size. However, the FAT
driver reads in terms of the device block size (from fat_set_blk_dev and
read_bootsectandvi) and sector size in the rest of the places.

This causes buffer overflows or partial reads when the FAT sector size
is not equal to device block size. Fix this by using blk_dread in
fat_set_blk_dev and read_bootsectandvi instead of disk_read. And update
disk_read/disk_write to handle FAT sector size and block size mismatch.

Tested on
	blksz | FAT sector size
	------+----------------
	4096  | 4096
	512   | 512
	4096  | 512
	512   | 4096

Signed-off-by: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
2026-03-10 11:52:14 -06:00

40 lines
1.3 KiB
Plaintext

config FS_FAT
bool "Enable FAT filesystem support"
help
This provides support for reading images from File Allocation Table
(FAT) filesystem. FAT filesystem is a legacy, lightweight filesystem.
It is useful mainly for its wide compatibility with various operating
systems. You can also enable CMD_FAT to get access to fat commands.
config FAT_WRITE
bool "Enable FAT filesystem write support"
depends on FS_FAT
help
This provides support for creating and writing new files to an
existing FAT filesystem partition.
config FAT_RENAME
bool "Enable filesystem rename support"
depends on FAT_WRITE
help
This provides support for renaming and moving files within a
FAT filesystem partition.
config FS_FAT_MAX_CLUSTSIZE
int "Set maximum possible clustersize"
default 65536
depends on FS_FAT
help
Set the maximum possible clustersize for the FAT filesytem. This
is the smallest amount of disk space that can be used to hold a
file. Unless you have an extremely tight memory memory constraints,
leave the default.
config FS_FAT_HANDLE_SECTOR_SIZE_MISMATCH
bool "Handle FAT sector size mismatch"
default n
depends on FS_FAT
help
Handle filesystems on media where the hardware block size and
the sector size in the FAT metadata do not match.