1. 27 2月, 2018 2 次提交
    • J
      udf: Clean up handling of invalid uid/gid · 0c9850f4
      Jan Kara 提交于
      Current code relies on the fact that invalid uid/gid as defined by UDF
      2.60 3.3.3.1 and 3.3.3.2 coincides with invalid uid/gid as used by the
      user namespaces implementation. Since this is only lucky coincidence,
      clean this up to avoid future surprises in case user namespaces
      implementation changes. Also this is more robust in presence of valid
      (from UDF point of view) uids / gids which do not map into current user
      namespace.
      Reviewed-by: NPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      0c9850f4
    • J
      udf: Ignore [ug]id=ignore mount options · 70260e44
      Jan Kara 提交于
      Currently uid=ignore and gid=ignore make no sense without uid=<number>
      and gid=<number> respectively as they result in all files having invalid
      uid / gid which then doesn't allow even root to modify files and thus
      causes confusion. And since commit ca76d2d8 "UDF: fix UID and GID
      mount option ignorance" (from over 10 years ago) uid=<number> overrides
      all uids on disk as uid=ignore does. So just silently ignore uid=ignore
      mount option.
      Reviewed-by: NPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      70260e44
  2. 17 10月, 2017 3 次提交
    • S
      udf: Fix some sign-conversion warnings · 89a4d970
      Steve Magnani 提交于
      Fix some warnings that appear when compiling with -Wconversion.
      A sub-optimal choice of variable type leads to warnings about
      conversion in both directions between unsigned and signed.
      Signed-off-by: NSteven J. Magnani <steve@digidescorp.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      89a4d970
    • S
      udf: Fix signed/unsigned format specifiers · fcbf7637
      Steve Magnani 提交于
      Fix problems noted in compilion with -Wformat=2 -Wformat-signedness.
      In particular, a mismatch between the signedness of a value and the
      signedness of its format specifier can result in unsigned values being
      printed as negative numbers, e.g.:
      
        Partition (0 type 1511) starts at physical 460, block length -1779968542
      
      ...which occurs when mounting a large (> 1 TiB) UDF partition.
      
      Changes since V1:
      * Fixed additional issues noted in udf_bitmap_free_blocks(),
        udf_get_fileident(), udf_show_options()
      Signed-off-by: NSteven J. Magnani <steve@digidescorp.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      fcbf7637
    • S
      udf: Fix 64-bit sign extension issues affecting blocks > 0x7FFFFFFF · b490bdd6
      Steve Magnani 提交于
      Large (> 1 TiB) UDF filesystems appear subject to several problems when
      mounted on 64-bit systems:
      
      * readdir() can fail on a directory containing File Identifiers residing
        above 0x7FFFFFFF. This manifests as a 'ls' command failing with EIO.
      
      * FIBMAP on a file block located above 0x7FFFFFFF can return a negative
        value. The low 32 bits are correct, but applications that don't mask the
        high 32 bits of the result can perform incorrectly.
      
      Per suggestion by Jan Kara, introduce a udf_pblk_t type for representation
      of UDF block addresses. Ultimately, all driver functions that manipulate
      UDF block addresses should use this type; for now, deployment is limited
      to functions with actual or potential sign extension issues.
      
      Changes to udf_readdir() and udf_block_map() address the issues noted
      above; other changes address potential similar issues uncovered during
      audit of the driver code.
      Signed-off-by: NSteven J. Magnani <steve@digidescorp.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b490bdd6
  3. 16 8月, 2017 2 次提交
  4. 14 6月, 2017 1 次提交
    • J
      udf: Fix deadlock between writeback and udf_setsize() · f2e95355
      Jan Kara 提交于
      udf_setsize() called truncate_setsize() with i_data_sem held. Thus
      truncate_pagecache() called from truncate_setsize() could lock a page
      under i_data_sem which can deadlock as page lock ranks below
      i_data_sem - e. g. writeback can hold page lock and try to acquire
      i_data_sem to map a block.
      
      Fix the problem by moving truncate_setsize() calls from under
      i_data_sem. It is safe for us to change i_size without holding
      i_data_sem as all the places that depend on i_size being stable already
      hold inode_lock.
      
      CC: stable@vger.kernel.org
      Fixes: 7e49b6f2Signed-off-by: NJan Kara <jack@suse.cz>
      f2e95355
  5. 24 4月, 2017 2 次提交
  6. 28 2月, 2017 1 次提交
  7. 10 1月, 2017 7 次提交
  8. 05 1月, 2017 1 次提交
    • J
      udf: Make stat on symlink report symlink length as st_size · ad4d0532
      Jan Kara 提交于
      UDF encodes symlinks in a more complex fashion and thus i_size of a
      symlink does not match the lenght of a string returned by readlink(2).
      This confuses some applications (see bug 191241) and may be considered a
      violation of POSIX. Fix the problem by reading the link into page cache
      in response to stat(2) call and report the length of the decoded path.
      Signed-off-by: NJan Kara <jack@suse.cz>
      ad4d0532
  9. 03 1月, 2017 1 次提交
  10. 01 11月, 2016 1 次提交
  11. 28 9月, 2016 1 次提交
  12. 08 6月, 2016 1 次提交
  13. 02 5月, 2016 1 次提交
  14. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  15. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  16. 04 1月, 2016 1 次提交
    • A
      udf: avoid uninitialized variable use · 4f1b1519
      Arnd Bergmann 提交于
      A new warning has come up from a recent cleanup:
      
      fs/udf/inode.c: In function 'udf_setup_indirect_aext':
      fs/udf/inode.c:1927:28: warning: 'adsize' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      If the alloc_type is neither ICBTAG_FLAG_AD_SHORT nor
      ICBTAG_FLAG_AD_LONG, the value of adsize is undefined. Currently,
      callers of these functions make sure alloc_type is one of the two valid
      ones but for future proofing make sure we handle the case of invalid
      alloc type as well.  This changes the code to return -EIOin that case.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: fcea62ba ("udf: Factor out code for creating indirect extent")
      Signed-off-by: NJan Kara <jack@suse.cz>
      4f1b1519
  17. 24 12月, 2015 2 次提交
    • J
      udf: Fix lost indirect extent block · 6c371578
      Jan Kara 提交于
      When inode ends with empty indirect extent block and we extended that
      file, udf_do_extend_file() ended up just overwriting pointer to it with
      another extent and thus effectively leaking the block and also
      corruptiong length of allocation descriptors.
      
      Fix the problem by properly following into next indirect extent when it
      is present.
      Signed-off-by: NJan Kara <jack@suse.cz>
      6c371578
    • J
      udf: Factor out code for creating indirect extent · fcea62ba
      Jan Kara 提交于
      Factor out code for creating indirect extent from udf_add_aext(). It was
      mostly duplicated in two places. Also remove some opencoded versions
      of udf_write_aext().
      Signed-off-by: NJan Kara <jack@suse.cz>
      fcea62ba
  18. 23 12月, 2015 1 次提交
  19. 09 12月, 2015 1 次提交
    • A
      don't put symlink bodies in pagecache into highmem · 21fc61c7
      Al Viro 提交于
      kmap() in page_follow_link_light() needed to go - allowing to hold
      an arbitrary number of kmaps for long is a great way to deadlocking
      the system.
      
      new helper (inode_nohighmem(inode)) needs to be used for pagecache
      symlinks inodes; done for all in-tree cases.  page_follow_link_light()
      instrumented to yell about anything missed.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      21fc61c7
  20. 07 12月, 2015 1 次提交
  21. 09 7月, 2015 1 次提交
    • S
      udf: Don't corrupt unalloc spacetable when writing it · 70f19f58
      Steven J. Magnani 提交于
      For a UDF filesystem configured with an Unallocated Space Table,
      a filesystem operation that triggers an update to the table results
      in on-disk corruption that prevents remounting:
      
        udf_read_tagged: tag version 0x0000 != 0x0002 || 0x0003, block 274
      
      For example:
        1. Create a filesystem
            $ mkudffs --media-type=hd --blocksize=512 --lvid=BUGTEST \
                    --vid=BUGTEST --fsid=BUGTEST --space=unalloctable \
                    /dev/mmcblk0
      
        2. Mount it
            # mount /dev/mmcblk0 /mnt
      
        3. Create a file
            $ echo "No corruption, please" > /mnt/new.file
      
        4. Umount
            # umount /mnt
      
        5. Attempt remount
            # mount /dev/mmcblk0 /mnt
      
      This appears to be a longstanding bug caused by zero-initialization of
      the Unallocated Space Entry block buffer and only partial repopulation
      of required fields before writing to disk.
      
      Commit 0adfb339fd64 ("udf: Fix unalloc space handling in udf_update_inode")
      addressed one such field, but several others are required.
      Signed-off-by: NSteven J. Magnani <steve@digidescorp.com>
      Signed-off-by: NJan Kara <jack@suse.com>
      70f19f58
  22. 12 4月, 2015 3 次提交
  23. 01 4月, 2015 1 次提交
  24. 26 3月, 2015 1 次提交
  25. 14 3月, 2015 1 次提交
  26. 05 2月, 2015 1 次提交