30 May, 2019
1 commit
-
Fix issue introduced by cherry-pick patch below, the conflict
is not resolved correctly
(MLK-20668-2 fat: Fix issue in rootdir table flush for FAT16/12)Signed-off-by: Ye Li
24 May, 2019
1 commit
-
The FAT16/12 has rootdir area before data area, and the clusters for
rootdir are not mantained by FAT table. So we don't need to find empty
cluster for next rootdir space, just use next dir cluster. And the FAT
table don't need to update for this new dir cluster.Signed-off-by: Ye Li
Acked-by: Peng Fan
(cherry picked from commit 9e0a33cacc0a7926d46c0ca184498ae88278816e)
23 Mar, 2019
1 commit
-
U-Boot doesn't support metadata_csum feature. Writing to filesystem with
metadata_csum feature makes the filesystem corrupted and unbootable by
Linux:[ 2.527495] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 0 failed (52188!=0)
[ 2.537421] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 1 failed (5262!=0)
...
[ 2.653308] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 14 failed (42611!=0)
[ 2.662179] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 15 failed (21527!=0)
[ 2.687920] JBD2: journal checksum error
[ 2.691982] EXT4-fs (mmcblk0p2): error loading journal
[ 2.698292] VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -74Don't write to filesystem with meatadata_csum feature to not corrupt the
filesystem.Signed-off-by: Sébastien Szymanski
01 Mar, 2019
1 commit
-
When compiling with DEBUG=1 an error
fs/fat/fat_write.c:831: undefined reference to `__aeabi_ldivmod'
occurred.We should use do_div() instead of the modulus operator.
filesize and cur_pos cannot be negative. So let's use u64 to avoid
warnings.Fixes: cb8af8af5ba0 ("fs: fat: support write with non-zero offset")
Signed-off-by: Heinrich Schuchardt
19 Feb, 2019
2 commits
-
Release cluster block immediately when no longer use would help to reduce
64KiB memory allocated to the memory pool.Signed-off-by: Tien Fong Chee
-
Drop the statically allocated get_contents_vfatname_block and
dynamically allocate a buffer only if required. This saves
64KiB of memory.Signed-off-by: Stefan Agner
Signed-off-by: Tien Fong Chee
09 Feb, 2019
1 commit
-
Unlike other generic FS accessors, fs_get_info() does not call fs_close()
at the end of it's operation. Thus, using fs_get_info() in do_fs_type()
without calling fs_close() causes potential memory leak by creating new
filesystem structures on each call of do_fs_type().The test case to trigger this problem is as follows. It is required to
have ext4 filesystem on the first partition of the SDMMC device, since
ext4 requires stateful mount and causes memory allocation.
=> while true ; do mmc rescan ; fstype mmc 1 ; done
Eventually, the mounting of ext4 will fail due to malloc failures
and the filesystem will not be correctly detected.This patch fixes the problem by adding the missing fs_close().
Signed-off-by: Marek Vasut
Cc: Simon Glass
Cc: Tom Rini
02 Feb, 2019
1 commit
-
This fixes the automatic lmb initialization and reservation for boards
with more than one DRAM bank.This fixes the CVE-2018-18439 and -18440 fixes that only allowed to load
files into the firs DRAM bank from fs and via tftp.Found-by: Heinrich Schuchardt
Signed-off-by: Simon Goldschmidt
Tested-by: Heinrich Schuchardt
Reviewed-by: Simon Glass
01 Feb, 2019
4 commits
-
CONFIG_SPL_FS_EXT4 can be used to include/exclude the FS EXT4 from
SPL build. Excluding the FS EXT4 from SPL build can help to save 20KiB
memory.Signed-off-by: Tien Fong Chee
Reviewed-by: Tom Rini -
Replace CONFIG_SPL_EXT_SUPPORT to CONFIG_SPLY_FS_EXT4 so both
obj-$(CONFIG_$(SPL_)FS_EXT4) and CONFIG_IS_ENABLED(FS_EXT4) can be
used to control the build in both SPL and U-Boot.Signed-off-by: Tien Fong Chee
Reviewed-by: Tom Rini -
Most of the time SPL only needs very simple FAT reading, so having
CONFIG_IS_ENABLED(FAT_WRITE) to exclude it from SPL build would help
to save 64KiB default max clustersize from memory.Signed-off-by: Tien Fong Chee
Reviewed-by: Simon Goldschmidt
Reviewed-by: Tom Rini -
Replace CONFIG_SPL_FAT_SUPPORT with CONFIG_SPL_FS_FAT so
obj-$(CONFIG_$(SPL_)FS_FAT) can be used to control the build in both
SPL and U-Boot.Signed-off-by: Tien Fong Chee
Reviewed-by: Simon Goldschmidt
Reviewed-by: Tom Rini
17 Jan, 2019
1 commit
-
This fixes CVE-2018-18440 ("insufficient boundary checks in filesystem
image load") by using lmb to check the load size of a file against
reserved memory addresses.Signed-off-by: Simon Goldschmidt
Reviewed-by: Simon Glass
11 Jan, 2019
1 commit
-
This particular commit is causing a regression on stih410-b2260 and
other platforms when reading from FAT16. Noting that I had rebased the
original fix from Thomas onto then-current master, there is also
question from Akashi-san if the change is still needed after other FAT
fixes that have gone in.This reverts commit a68b0e11ea774492713a65d9fd5bb525fcaefff3.
Reported-by: Patrice Chotard
Cc: AKASHI Takahiro
Cc: Thomas RIENOESSL
Signed-off-by: Tom Rini
31 Dec, 2018
2 commits
-
The call to file_cbfs_fill_cache() is given with the parameter
'start' pointing to the offset by the CBFS base address, but
with the parameter 'size' that equals to the whole CBFS size.
During CBFS walking through, it checks files one by one and
after it pass over the end of the CBFS which is 4GiB boundary
it tries to check files from address 0 and so on, until the
overall size the codes checked hits to the given 'size'.Fix this by passing 'start' pointing to the CBFS base address.
Signed-off-by: Bin Meng
Reviewed-by: Simon Glass -
cbfs_fileheader.len indicates the content size of the file in the
cbfs, and it has nothing to do with cbfs_fileheader.offset which
is the starting address of the file in the cbfs.Remove such check in file_cbfs_next_file(). Before this change
'cbfsinit' failed with 'Bad CBFS file'. After this change all cbfs
commands are working as expected.Signed-off-by: Christian Gmeiner
[bmeng: keep the necessary header sanity check]
Signed-off-by: Bin Meng
Reviewed-by: Simon Glass
07 Dec, 2018
2 commits
-
The long name apparently can be accumulated using multiple
13-byte slots. Unfortunately we never checked how many we
can actually fit in the buffer we are reading to.Signed-off-by: Patrick Wildt
-
The cluster size specifies how many sectors make up a cluster. A
cluster size of zero makes no sense, as it would mean that the
cluster is made up of no sectors. This will later lead into a
division by zero in sect_to_clust(), so better take care of that
early.The MAX_CLUSTSIZE define can reduced using a define to make some
room in low-memory system. Unfortunately if the code reads a
filesystem with a bigger cluster size it will overflow the buffer.Signed-off-by: Patrick Wildt
03 Dec, 2018
1 commit
-
As in the case of fs_set_blk_dev(), fs_set_blk_dev_with_part() should
maintain and update fs_dev_part whenever called.Without this patch, a problem will come up when an efi binary associated
with efi's BOOTxxxx variable is invoked via "bootefi bootmgr".Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf
21 Nov, 2018
1 commit
-
This fixes problems accessing drives formated under
Windows as FAT16.Signed-off-by: Thomas RIENOESSL
[trini: Rebase on top of f528c140c801]
Signed-off-by: Tom Rini
17 Nov, 2018
1 commit
-
Add fs.c under SPL as well as it is needed for fs_loader
Signed-off-by: Keerthy
Reviewed-by: Simon Glass
[trini: Add as obj-$(CONFIG_FS_LOADER) for non-SPL_FRAMEWORK builds]
Signed-off-by: Tom Rini
07 Nov, 2018
1 commit
-
Add local size_t variable to crypto_comp_decompress as intermediate
storage for destination length to avoid memory corruption and incorrect
results on 64 bit targets.This is what linux does for the various lz compression implementations.
Signed-off-by: Paul Davey
Cc: Heiko Schocher
Tested-by: Heiko Schocher
16 Oct, 2018
1 commit
-
As observed with clang:
fs/fat/fat_write.c:1024:13: warning: comparison of constant 128
with expression of type 'char' is always false
[-Wtautological-constant-out-of-range-compare]
if ((0x80
Signed-off-by: Alexander Graf
09 Oct, 2018
1 commit
-
When traversing slots in a btree (via btrfs_path) with btrfs_next_slot(),
we didn't correctly identify that the last slot in the leaf was reached
and we should jump to the next leaf.This could lead to any kind of runtime errors or corruptions, like:
* file data not being read at all, or is read partially
* file is read but is corrupted
* (any) metadata being corrupted or not read at all, etcThe easiest way to reproduce this is to read a large enough file that
its EXTENT_DATA items don't fit into a single leaf.Signed-off-by: Yevgeny Popovych
Cc: Marek Behun
Tested-by: Marek Behún
07 Oct, 2018
2 commits
-
Avoid CoverityScan warning SIGN_EXTENSION by changing the type of
parameter size of set_cluster().Avoid leaking stack content when writing an incomplete last sector.
Reported-by: Coverity (CID: 184096)
Signed-off-by: Heinrich Schuchardt -
Do not leak filename_copy in case of error.
Catch out of memory when calling strdup.Reported-by: Coverity (CID: 184086)
Signed-off-by: Heinrich Schuchardt
01 Oct, 2018
1 commit
-
The btrfs implementation passes cache-unaligned buffers into the
block layer, which triggers cache alignment problems down in the
block device drivers. Align the buffers to prevent this.Signed-off-by: Marek Vasut
Cc: Marek Behun
24 Sep, 2018
13 commits
-
The FAT driver supports unaligned reads and writes and EFI applications
will make use of these. So a misaligned buffer is only worth a debug
message.Signed-off-by: Heinrich Schuchardt
Signed-off-by: Alexander Graf -
In this patch, unlink support is added to FAT file system.
A directory can be deleted only if it is empty.In this implementation, only a directory entry for a short file name
will be removed. So entries for a long file name can and should be
reclaimed with fsck.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
"unlink" interface is added to file operations.
This is a preparatory change as unlink support for FAT file system
will be added in next patch.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
In this patch, mkdir support is added to FAT file system.
A newly created directory contains only "." and ".." entries.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
The starting cluster number of directory is needed to initialize ".."
(parent directory) entry when creating a new directory.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
"mkdir" interface is added to file operations.
This is a preparatory change as mkdir support for FAT file system
will be added in next patch.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
In this patch, all the necessary code for allowing for a file offset
at write is implemented. What plays a major roll here is get_set_cluster(),
which, in contrast to its counterpart, set_cluster(), only operates on
already-allocated clusters, overwriting with data.So, with a file offset specified, set_contents() seeks and writes data
with set_get_cluster() until the end of a file, and, once it reaches
there, continues writing with set_cluster() for the rest.Please note that a file will be trimmed as a result of write operation if
write ends before reaching file's end. This is an intended behavior
in order to maintain compatibility with the current interface.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
The current write implementation is quite simple: remove existing clusters
and then allocating new ones and filling them with data. This, inevitably,
enforces always writing from the beginning of a file.As the first step to lift this restriction, fat_file_write() and
set_contents() are modified to accept an additional parameter, file offset
and further re-factored so that, in the next patch, all the necessary code
will be put into set_contents().Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
In this patch, write implementation is overhauled and rewritten by
making full use of directory iterator. The obvious bonus is that we are
now able to write to a file with a directory path, like /A/B/C/FILE.Please note that, as there is no notion of "current directory" on u-boot,
a file name specified must contain an absolute directory path. Otherwise,
"/" (root directory) is assumed.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
It would be good that FAT write function return error code instead of
just returning -1 as fat_read_file() does.
This patch attempts to address this issue although it is 'best effort
(or estimate)' for now.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
FAT file system's long file name support is a bit complicated and has some
restrictions on its naming. We should be careful about it especially for
write as it may easily end up with wrong file system.normalize_longname() check for the rules and normalize a file name
if necessary. Please note, however, that this function is yet to be
extended to fully comply with the standard.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
This reverts commit 0dc1bfb7302d220a48364263d5632d6d572b069b.
The succeeding patch series will supersede it.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
In my attempt to re-work write operation, it was revealed that iterator's
"clust" does not always point to a cluster to which a current directory
entry ("dent") belongs.
This patch assures that it is always true by adding "next_clust" which is
used solely for dereferencing a cluster chain.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf