Commit 8df8731474467782c6126f41da87618bcb84852a
Committed by
Tom Rini
1 parent
edce588a45
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
fs/fat: Fix pathnames using '..' that lead to the root directory
If we end up back in the root directory via a '..' directory entry, set itr->is_root accordingly. Failing to do that gives spews like "Invalid FAT entry" and being unable to access directory entries located past the first cluster of the root directory. Fixes: 8eafae209c35 ("fat/fs: convert to directory iterators") Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
fs/fat/fat.c
... | ... | @@ -710,13 +710,14 @@ |
710 | 710 | itr->fsdata = parent->fsdata; |
711 | 711 | if (clustnum > 0) { |
712 | 712 | itr->clust = clustnum; |
713 | + itr->is_root = 0; | |
713 | 714 | } else { |
714 | 715 | itr->clust = parent->fsdata->root_cluster; |
716 | + itr->is_root = 1; | |
715 | 717 | } |
716 | 718 | itr->dent = NULL; |
717 | 719 | itr->remaining = 0; |
718 | 720 | itr->last_cluster = 0; |
719 | - itr->is_root = 0; | |
720 | 721 | } |
721 | 722 | |
722 | 723 | static void *next_cluster(fat_itr *itr) |