Skip to content
Snippets Groups Projects
  1. Nov 23, 2015
    • Thomas Fitzsimmons's avatar
      fs: ext4: Prevent infinite loop in ext4fs_iterate_dir · 54d68e93
      Thomas Fitzsimmons authored and Tom Rini's avatar Tom Rini committed
      
      If the ext3 journal gets out of sync with what is written on disk, for
      example because of an unexpected power cut, ext4fs_read_file can
      return an all-zero directory entry.  In that case, ext4fs_iterate_dir
      would infinite loop.
      
      This patch detects when a directory entry's direntlen member is 0 and
      returns a failure status, which breaks out of the infinite loop.  As a
      result, U-Boot will not find files that may subsequently be recovered
      when the journal is replayed.
      
      This is better behaviour than hanging in an infinite loop, but as a
      further improvement maybe U-Boot could interpret the ext3 journal and
      actually find the unsynced entries.
      
      Signed-off-by: default avatarThomas Fitzsimmons <fitzsim@cisco.com>
      Reviewed-by: default avatarStefan Roese <sr@denx.de>
      54d68e93
  2. Nov 10, 2015
    • Tom Rini's avatar
      Various Makefiles: Add SPDX-License-Identifier tags · da58dec8
      Tom Rini authored
      
      After consulting with some of the SPDX team, the conclusion is that
      Makefiles are worth adding SPDX-License-Identifier tags too, and most of
      ours have one.  This adds tags to ones that lack them and converts a few
      that had full (or in one case, very partial) license blobs into the
      equivalent tag.
      
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      da58dec8
  3. Nov 05, 2015
  4. Oct 26, 2015
  5. Oct 24, 2015
  6. Oct 11, 2015
  7. Sep 11, 2015
    • Gary Bisson's avatar
      fs: ext4: fix symlink read function · 9d2f6a9a
      Gary Bisson authored and Tom Rini's avatar Tom Rini committed
      
      Since last API changes for files >2GB, the read of symlink is broken as
      ext4fs_read_file now returns 0 instead of the length of the actual read.
      
      Signed-off-by: default avatarGary Bisson <gary.bisson@boundarydevices.com>
      9d2f6a9a
    • Stephen Warren's avatar
      ext4: fix leak in check_filename() · d56b2015
      Stephen Warren authored and Tom Rini's avatar Tom Rini committed
      
      root_first_block_buffer should be free()d in all cases, not just when an
      error occurs. Fix the success exit path of the function to do this.
      
      Signed-off-by: Stephen Warren's avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      d56b2015
    • Stephen Warren's avatar
      ext4: free allocations by parse_path() · 934b14f2
      Stephen Warren authored and Tom Rini's avatar Tom Rini committed
      
      parse_path() malloc()s the entries in the array it's passed. Those
      allocations must be free()d by the caller, ext4fs_get_parent_inode_num().
      Add code to do this.
      
      For this to work, all the array entries must be dynamically allocated,
      rather than a mix of dynamic and static allocations. Fix parse_path() not
      to over-write arr[0] with a pointer to statically allocated data.
      
      Signed-off-by: Stephen Warren's avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      934b14f2
    • Stephen Warren's avatar
      ext4: avoid calling ext4fs_mount() twice, which leaks · 676505f5
      Stephen Warren authored and Tom Rini's avatar Tom Rini committed
      
      ext4_write_file() is only called from the "fs" layer, which calls both
      ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file().
      Fix ext4_write_file() not to call ext4fs_mount() again, since the mount
      operation malloc()s some RAM which is leaked when a second mount call
      over-writes the pointer to that data, if no intervening close call is
      made.
      
      Signed-off-by: Stephen Warren's avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      676505f5
    • Łukasz Majewski's avatar
      FIX: fat: Provide correct return code from disk_{read|write} to upper layers · 0a04ed86
      Łukasz Majewski authored and Tom Rini's avatar Tom Rini committed
      
      It is very common that FAT code is using following pattern:
      if (disk_{read|write}() < 0)
              return -1;
      
      Up till now the above code was dead, since disk_{read|write) could only
      return value >= 0.
      As a result some errors from medium layer (i.e. eMMC/SD) were not caught.
      
      The above behavior was caused by block_{read|write|erase} declared at
      struct block_dev_desc (@part.h). It returns unsigned long, where 0
      indicates error and > 0 indicates that medium operation was correct.
      
      This patch as error regards 0 returned from block_{read|write|erase}
      when nr_blocks is grater than zero. Read/Write operation with nr_blocks=0
      should return 0 and hence is not considered as an error.
      
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      
      Test HW: Odroid XU3 - Exynos 5433
      0a04ed86
    • Simon Glass's avatar
      Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header · cf92e05c
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Now that we have a new header file for cache-aligned allocation, we should
      move the stack-based allocation macro there also.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      cf92e05c
    • Simon Glass's avatar
      Move malloc_cache_aligned() to its own header · 6e295186
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present malloc.h is included everywhere since it recently was added to
      common.h in this commit:
      
         4519668b mtd/nand/ubi: assortment of alignment fixes
      
      This seems wasteful and unnecessary. We have been trying to trim down
      common.h and put separate functions into separate header files and that
      change goes in the opposite direction.
      
      Move malloc_cache_aligned() to a new header so that this can be avoided.
      The header would perhaps be better named as alignmem.h but it needs to be
      included after common.h and people might be confused by this. With the name
      memalign.h it fits nicely after malloc() in most cases.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Acked-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
      6e295186
    • Stephen Warren's avatar
      fat: handle paths that include ../ · 18a10d46
      Stephen Warren authored and Tom Rini's avatar Tom Rini committed
      
      The FAT code contains a special case to parse the root directory. This
      is needed since the root directory location/layout on disk is special
      cased for FAT12/16. In particular, the location and size of the FAT12/16
      root directory is hard-coded and contiguous, whereas all FAT12/16 non-root
      directories, and all FAT32 directories, are stored in a non-contiguous
      fashion, with the layout represented by a linked-list of clusters in the
      FAT.
      
      If a file path contains ../ (for example /extlinux/../bcm2835-rpi-cm.dtb),
      it is possible to need to parse the root directory for the first element
      in the path (requiring application of the special case), then a sub-
      directory (in the general way), then re-parse the root directory (again
      requiring the special case). However, the current code in U-Boot only
      applies the special case for the very first path element, and never for
      any later path element. When reparsing the root directory without
      applying the special case, any file in a sector (or cluster?) other than
      the first sector/cluster of the root directory will not be found.
      
      This change modifies the non-root-dir-parsing loop of do_fat_read_at()
      to detect if it's walked back to the root directory, and if so, jumps
      back to the special case code that handles parsing of the root directory.
      
      This change was tested using sandbox by executing:
      
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/.."
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/.."
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/../"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /backup/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/..backup/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/../backup/../bcm2835-rpi-cm.dtb"
      
      (/extlinux and /backup are in different sectors so trigger some different
      cases, and bcm2835-rpi-cm.dtb is in a sector of the root directory other
      than the first).
      
      In all honesty, this change is a bit of a hack, using goto and all.
      However, as demonstrated above it appears to work well in practice, is
      quite minimal, likely doesn't introduce any risk of regressions, and
      hopefully doesn't introduce any maintenance issues.
      
      The correct fix would be to collapse the root and non-root loops in
      do_fat_read_at() and get_dentfromdir() into a single loop that has a
      small special-case when moving from one sector to the next, to handle
      the layout difference of root/non-root directories. AFAIK all other
      aspects of directory parsing are identical. However, that's a much
      larger change which needs significantly more thought before it's
      implemented.
      
      Signed-off-by: default avatarStephen Warren <swarren@wwwdotorg.org>
      18a10d46
  8. Aug 28, 2015
  9. Aug 13, 2015
  10. Apr 19, 2015
  11. Apr 18, 2015
  12. Mar 06, 2015
  13. Jan 29, 2015
  14. Jan 28, 2015
  15. Jan 05, 2015
    • Przemyslaw Marczak's avatar
      fs: fat: read: fix fat16 ls/read issue · 64f65e1e
      Przemyslaw Marczak authored
      
      The present fat implementation ignores FAT16 long name
      directory entries which aren't placed in a single sector.
      
      This was becouse of the buffer was always filled by the
      two sectors, and the loop was made also for two sectors.
      
      If some file long name entries are stored in two sectors,
      the we have two cases:
      
      Case 1:
      Both of sectors are in the buffer - all required data
      for long file name is in the buffer.
      - Read OK!
      
      Case 2:
      The current directory entry is placed at the end of the
      second buffered sector. And the next entries are placed
      in a sector which is not buffered yet. Then two next
      sectors are buffered and the mentioned entry is ignored.
      - Read fail!
      
      This commit fixes this issue by:
      - read two sectors after loop on each single is done
      - keep the last used sector as a first in the buffer
        before the read of two next
      
      The commit doesn't affects the fat32 imlementation,
      which works good as previous.
      
      Signed-off-by: default avatarPrzemyslaw Marczak <p.marczak@samsung.com>
      Cc: Mikhail Zolotaryov <lebon@lebon.org.ua>
      Cc: Tom Rini <trini@ti.com>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Suriyan Ramasami <suriyan.r@gmail.com>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Wolfgang Denk <wd@denx.de>
      Tested-by: default avatarSimon Glass <sjg@chomium.org>
      64f65e1e
  16. Dec 01, 2014
  17. Nov 23, 2014
Loading