]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs/fat: Fix pathnames using '..' that lead to the root directory
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Mon, 25 Sep 2017 19:06:33 +0000 (22:06 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 6 Oct 2017 15:28:19 +0000 (11:28 -0400)
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>
fs/fat/fat.c

index 36a309c73c2713f73a8f7f4f873b6e0d7ae21d68..3d3e17e8facc839fe120fe0536d6ded6ad9bdbe2 100644 (file)
@@ -710,13 +710,14 @@ static void fat_itr_child(fat_itr *itr, fat_itr *parent)
        itr->fsdata = parent->fsdata;
        if (clustnum > 0) {
                itr->clust = clustnum;
+               itr->is_root = 0;
        } else {
                itr->clust = parent->fsdata->root_cluster;
+               itr->is_root = 1;
        }
        itr->dent = NULL;
        itr->remaining = 0;
        itr->last_cluster = 0;
-       itr->is_root = 0;
 }
 
 static void *next_cluster(fat_itr *itr)