zephyr/subsys/fs
Tobias Svehagen 50ed105d05 fs: nvs: Fix handling of corrupt ate's in garbage collector
nvs_gc does not verify the crc8 of close_ate before using
close_ate.offset.  This means that close_ate.offset could contain an
offset that points beyond valid ate's in the sector. For example, there
might be a valid ate at offset 0x100 but close_ate.offset is 0x200.
If that is the case that value will not be moved and so it will be lost.

Solve this by refactoring the recovery loop from nvs_prev_ate into
nvs_recover_last_ate and use that function in nvs_gc if a corrupt
close_ate is found.

The crc8 of gc_ate is not checked before trying to find another ate
with the same id. If there are no valid ate with that id in the whole
fs the inner while(1)-loop will never stop since the break condition
includes a check for a correct crc8.

Solve this by skipping gc_ate's with an invalid crc8.

Fixes #26407

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-06-26 12:07:13 -05:00
..
fcb zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
nvs fs: nvs: Fix handling of corrupt ate's in garbage collector 2020-06-26 12:07:13 -05:00
CMakeLists.txt fs: remove NFFS subsystem 2020-01-21 15:32:47 +01:00
Kconfig subsys/fs/fatfs: Add kconfig option for FAT LFN (Long Filename) 2020-01-23 17:50:19 +01:00
Kconfig.littlefs global: Remove leading/trailing blank lines in files 2019-12-11 19:17:27 +01:00
fat_fs.c subsys/fs/fatfs: Fix missing memory free on error 2020-06-25 12:13:51 +02:00
fs.c
fs_impl.c
fs_impl.h
fuse_fs_access.c zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
littlefs_fs.c subsys/fs/littlefs: initialize LittleFS at POST_KERNEL 2020-06-09 13:48:34 +02:00
shell.c zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00