fat32 root directory handling

7 views
Skip to first unread message

pmaheral

unread,
Jun 10, 2011, 1:03:32 PM6/10/11
to x-loader
I stumbled across a bug in the FAT32 root directory handling. I
generated a simple patch, but then found that the same bug existed in
u-boot, and has already been fixed by Erik Hansen. Should I try to
port his patch to x-loader, or is someone already working on this?

The following is the commit log for Erik Hansen's patch:

(from: http://git.denx.de/u-boot.git/?p=u-boot.git;a=commit;h=3f270f42d7d87f681b4c500e94eabc3dfea03eb4)

fat32 root directory handling

Fat directory handling didn't check reaching the end of the root
directory. It
relied on a stop condition based on a directory entry with a name
starting with
a '\0' character. This check in itself is wrong ('\0' indicates free
entry, not
end_of_directory) but outside the scope of this fix. For FAT32, the
end of the
rootdir is reached when the end of the cluster chain is reached. The
code didn't
check this condition and started to read an incorrect cluster. This
caused a
subsequent read request of a sector outside the range of the usb stick
in
use. On its turn, the usb stick protested with a stall handshake.

Both FAT32 and non-FAT32 (FAT16/FAT12) end or rootdir checks have been
put in.
Reply all
Reply to author
Forward
0 new messages