21 Nov, 2018

1 commit


17 Nov, 2018

1 commit


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

    Paul Davey
     

16 Oct, 2018

1 commit


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, etc

    The 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

    Yevgeny Popovych
     

07 Oct, 2018

2 commits


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

    Marek Vasut
     

24 Sep, 2018

15 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

    Heinrich Schuchardt
     
  • 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

    AKASHI Takahiro
     
  • "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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • "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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • This reverts commit 0dc1bfb7302d220a48364263d5632d6d572b069b.
    The succeeding patch series will supersede it.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     
  • 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

    AKASHI Takahiro
     
  • FAT's root directory does not have "." nor ".."
    So care must be taken when scanning root directory with fat_itr_resolve().
    Without this patch, any file path starting with "." or ".." will not be
    resolved at all.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     
  • get_fs_info() was introduced in major re-work of read operation by Rob.
    We want to reuse this function in write operation by extending it with
    additional members in fsdata structure.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     

14 Sep, 2018

1 commit


11 Sep, 2018

1 commit

  • In int-ll64.h, we always use the following typedefs:

    typedef unsigned int u32;
    typedef unsigned long uintptr_t;
    typedef unsigned long long u64;

    This does not need to match to the compiler's .
    Do not include it.

    The use of PRI* makes the code super-ugly. You can simply use
    "l" for printing uintptr_t, "ll" for u64, and no modifier for u32.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

20 Aug, 2018

1 commit


14 Aug, 2018

1 commit


25 Jul, 2018

1 commit

  • fs_fat_write() is not able to write to subdirectories.

    Currently if a filepath with a leading slash is passed, the slash is
    treated as part of the filename to be created in the root directory.

    Strip leading (back-)slashes.

    Check that the remaining filename does not contain any illegal characters
    (<>:"/\|?*). This way we will throw an error when trying to write to a
    subdirectory.

    Signed-off-by: Heinrich Schuchardt
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     

21 Jul, 2018

1 commit

  • The comparison
    logical > item->logical + item->length
    in btrfs_map_logical_to_physical is wrong and should be instead
    logical >= item->logical + item->length
    For example, if
    item->logical = 4096
    item->length = 4096
    and we are looking for logical = 8192, it is not part of item (item is
    [4096, 8191]). But the comparison is false and we think we have found
    the correct item, although we should be searing in the right subtree.

    This fixes some bugs I encountered.

    Signed-off-by: Marek Behun

    Marek Behún
     

12 Jul, 2018

1 commit

  • By checking ubifs source code, s_instances parameter is not
    used anymore. So, set this parameter and the associated source
    code under __UBOOT__ compilation.

    Signed-off-by: Christophe Kerello
    Signed-off-by: Patrice Chotard

    Christophe Kerello
     

19 Jun, 2018

1 commit

  • This is the case when reading freshly created filesystem.
    The error message is like the following:
    btrfs_read_superblock: No valid root_backup found!

    Since the data from super_roots/root_backups is not actually used -
    decided to rework btrfs_newest_root_backup() into
    btrfs_check_super_roots() that will only check if super_roots
    array is valid and correctly handle empty scenario.

    As a result:
    * btrfs_read_superblock() now only checks if super_roots array is valid;
    the case when it is empty is considered OK.
    * removed root_backup pointer from btrfs_info,
    which would be NULL in case of empty super_roots.
    * btrfs_read_superblock() verifies number of devices from the superblock
    itself, not newest root_backup.

    Signed-off-by: Yevgeny Popovych
    Cc: Marek Behun
    Cc: Sergey Struzh

    Yevgeny Popovych
     

13 Jun, 2018

2 commits

  • Often during debugging session it's very interesting to see
    what data we were dealing with. For example what we write or read
    to/from memory or peripherals.

    This change introduces functions that allow to dump binary
    data with one simple function invocation like:
    ------------------->8----------------
    print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
    ------------------->8----------------

    which gives us the following:
    ------------------->8----------------
    00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
    00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
    00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
    00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
    00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
    00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
    00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
    00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
    00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
    00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
    000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
    000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
    000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
    ...
    ------------------->8----------------

    Source of hexdump.c was copied from Linux kernel v4.7-rc2.

    Signed-off-by: Alexey Brodkin
    Cc: Anatolij Gustschin
    Cc: Mario Six
    Cc: Simon Glass
    Cc: Tom Rini
    Cc: Stefan Roese

    Alexey Brodkin
     
  • This causes errors when translating logical addresses to physical:
    btrfs_map_logical_to_physical: Cannot map logical address to physical
    btrfs_file_read: Error reading extent

    The behavior of btrfs_map_logical_to_physical() is to stop traversing
    CHUNK_TREE when it encounters first non-CHUNK_ITEM, which makes
    only some portion of CHUNK_ITEMs being read.
    Change it to skip over non-chunk items.

    Signed-off-by: Yevgeny Popovych
    Cc: Marek Behun
    Cc: Sergey Struzh
    Reviewed-by: Marek Behun

    Yevgeny Popovych
     

30 May, 2018

1 commit


24 May, 2018

1 commit

  • Found a crash while issuing ext4ls with a non-existent directory.
    Crash test:

    => ext4ls mmc 0 1
    ** Can not find directory. **
    data abort
    pc : [] lr : []
    reloc pc : [] lr : []
    sp : 3f963338 ip : 3fdc3dc4 fp : 3fd6b370
    r10: 00000004 r9 : 3f967ec0 r8 : 3f96db68
    r7 : 3fdc99b4 r6 : 00000000 r5 : 3f96dc88 r4 : 3fdcbc8c
    r3 : fffffffa r2 : 00000000 r1 : 3f96e0bc r0 : 00000002
    Flags: nZCv IRQs off FIQs off Mode SVC_32
    Resetting CPU ...

    resetting ...

    Tested on SAMA5D2_Xplained board (sama5d2_xplained_mmc_defconfig)

    Looks like crash is introduced by commit:
    "fa9ca8a" fs/ext4/ext4fs.c: Free dirnode in error path of ext4fs_ls

    Issue is that dirnode is not initialized, and then freed if the call
    to ext4_ls fails. ext4_ls will not change the value of dirnode in this case
    thus we have a crash with data abort.

    I added initialization and a check for dirname being NULL.

    Fixes: "fa9ca8a" fs/ext4/ext4fs.c: Free dirnode in error path of ext4fs_ls
    Cc: Stefan Brüns
    Cc: Tom Rini
    Signed-off-by: Eugen Hristev
    Reviewed-by: Tom Rini

    Eugen Hristev
     

09 May, 2018

1 commit

  • This patch solves assert failed displayed in the console during a boot.
    The root cause is that the ubifs_inode is not already allocated when
    ubifs_printdir and ubifs_finddir functions are called.

    Trace showing the issue:
    feed 'boot.scr.uimg', ino 94, new f_pos 0x17b40ece
    dent->ch.sqnum '7132', creat_sqnum 3886945402880
    UBIFS assert failed in ubifs_finddir at 436
    INODE ALLOCATION: creat_sqnum '7129'
    Found U-Boot script /boot.scr.uimg

    Signed-off-by: Christophe Kerello
    Signed-off-by: Patrice Chotard

    Patrice Chotard
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

11 Apr, 2018

1 commit

  • The mutex lock and unlock functions are stubbed out and mutex_is_locked
    was 0. This caused asserts to fail in ubifs code when checking that the
    mutex was locked. For example,

    UBIFS assert failed in ubifs_change_lp at 540
    UBIFS assert failed in ubifs_release_lprops at 278

    Assume that the "mutex" is locked since that is the normal case when it
    is checked in the ubifs code.

    Signed-off-by: Bradley Bolen

    Bradley Bolen
     

07 Apr, 2018

1 commit


31 Mar, 2018

1 commit