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> |
||
|---|---|---|
| .. | ||
| fcb | ||
| nvs | ||
| CMakeLists.txt | ||
| fat_fs.c | ||
| fs_impl.c | ||
| fs_impl.h | ||
| fs.c | ||
| fuse_fs_access.c | ||
| Kconfig | ||
| Kconfig.littlefs | ||
| littlefs_fs.c | ||
| shell.c | ||