22 Oct, 2020

2 commits


07 Oct, 2020

1 commit

  • syzbot reported warning message:

    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x1d6/0x29e lib/dump_stack.c:118
    register_lock_class+0xf06/0x1520 kernel/locking/lockdep.c:893
    __lock_acquire+0xfd/0x2ae0 kernel/locking/lockdep.c:4320
    lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
    __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
    _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
    spin_lock include/linux/spinlock.h:354 [inline]
    exfat_cache_inval_inode+0x30/0x280 fs/exfat/cache.c:226
    exfat_evict_inode+0x124/0x270 fs/exfat/inode.c:660
    evict+0x2bb/0x6d0 fs/inode.c:576
    exfat_fill_super+0x1e07/0x27d0 fs/exfat/super.c:681
    get_tree_bdev+0x3e9/0x5f0 fs/super.c:1342
    vfs_get_tree+0x88/0x270 fs/super.c:1547
    do_new_mount fs/namespace.c:2875 [inline]
    path_mount+0x179d/0x29e0 fs/namespace.c:3192
    do_mount fs/namespace.c:3205 [inline]
    __do_sys_mount fs/namespace.c:3413 [inline]
    __se_sys_mount+0x126/0x180 fs/namespace.c:3390
    do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    If exfat_read_root() returns an error, spinlock is used in
    exfat_evict_inode() without initialization. This patch combines
    exfat_cache_init_inode() with exfat_inode_init_once() to initialize
    spinlock by slab constructor.

    Fixes: c35b6810c495 ("exfat: add exfat cache")
    Cc: stable@vger.kernel.org # v5.7+
    Reported-by: syzbot
    Signed-off-by: Namjae Jeon

    Namjae Jeon
     

12 Aug, 2020

2 commits

  • MediaFailure and VolumeDirty should be retained if these are set before
    mounting.

    In '3.1.13.3 Media Failure Field' of exfat specification describe:

    If, upon mounting a volume, the value of this field is 1,
    implementations which scan the entire volume for media failures and
    record all failures as "bad" clusters in the FAT (or otherwise resolve
    media failures) may clear the value of this field to 0.

    Therefore, We should not clear MediaFailure without scanning volume.

    In '8.1 Recommended Write Ordering' of exfat specification describe:

    Clear the value of the VolumeDirty field to 0, if its value prior to
    the first step was 0.

    Therefore, We should not clear VolumeDirty after mounting.
    Also rename ERR_MEDIUM to MEDIA_FAILURE.

    Signed-off-by: Tetsuhiro Kohada
    Signed-off-by: Namjae Jeon

    Tetsuhiro Kohada
     
  • Add error check when synchronously updating dir-entries.

    Suggested-by: Sungjong Seo
    Signed-off-by: Tetsuhiro Kohada
    Signed-off-by: Namjae Jeon

    Tetsuhiro Kohada
     

10 Jun, 2020

1 commit

  • Pull exfat update from Namjae Jeon:
    "Bug fixes:
    - Fix memory leak on mount failure with iocharset= option
    - Fix incorrect update of stream entry
    - Fix cluster range validation error

    Clean-ups:
    - Remove unused code and unneeded assignment
    - Rename variables in exfat structure as specification
    - Reorganize boot sector analysis code
    - Simplify exfat_utf8_d_hash and exfat_utf8_d_cmp()
    - Optimize exfat entry cache functions
    - Improve wording of EXFAT_DEFAULT_IOCHARSET config option

    New Feature:
    - Add boot region verification"

    * tag 'exfat-for-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
    exfat: Fix potential use after free in exfat_load_upcase_table()
    exfat: fix range validation error in alloc and free cluster
    exfat: fix incorrect update of stream entry in __exfat_truncate()
    exfat: fix memory leak in exfat_parse_param()
    exfat: remove unnecessary reassignment of p_uniname->name_len
    exfat: standardize checksum calculation
    exfat: add boot region verification
    exfat: separate the boot sector analysis
    exfat: redefine PBR as boot_sector
    exfat: optimize dir-cache
    exfat: replace 'time_ms' with 'time_cs'
    exfat: remove the assignment of 0 to bool variable
    exfat: Remove unused functions exfat_high_surrogate() and exfat_low_surrogate()
    exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF
    exfat: Improve wording of EXFAT_DEFAULT_IOCHARSET config option
    exfat: Use a more common logging style
    exfat: Simplify exfat_utf8_d_cmp() for code points above U+FFFF

    Linus Torvalds
     

09 Jun, 2020

2 commits

  • Optimize directory access based on exfat_entry_set_cache.
    - Hold bh instead of copied d-entry.
    - Modify bh->data directly instead of the copied d-entry.
    - Write back the retained bh instead of rescanning the d-entry-set.
    And
    - Remove unused cache related definitions.

    Signed-off-by: Tetsuhiro Kohada
    Reviewed-by: Sungjong Seo
    Signed-off-by: Namjae Jeon

    Tetsuhiro Kohada
     
  • Replace time_ms with time_cs in the file directory entry structure
    and related functions.

    The unit of create_time_ms/modify_time_ms in File Directory Entry are not
    'milli-second', but 'centi-second'.
    The exfat specification uses the term '10ms', but instead use 'cs' as in
    msdos_fs.h.

    Signed-off-by: Tetsuhiro Kohada
    Signed-off-by: Namjae Jeon

    Tetsuhiro Kohada
     

03 Jun, 2020

1 commit

  • Implement the new readahead aop and convert all callers (block_dev,
    exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qnx6,
    reiserfs & udf).

    The callers are all trivial except for GFS2 & OCFS2.

    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Andrew Morton
    Reviewed-by: Junxiao Bi # ocfs2
    Reviewed-by: Joseph Qi # ocfs2
    Reviewed-by: Dave Chinner
    Reviewed-by: John Hubbard
    Reviewed-by: Christoph Hellwig
    Reviewed-by: William Kucharski
    Cc: Chao Yu
    Cc: Cong Wang
    Cc: Darrick J. Wong
    Cc: Eric Biggers
    Cc: Gao Xiang
    Cc: Jaegeuk Kim
    Cc: Michal Hocko
    Cc: Zi Yan
    Cc: Johannes Thumshirn
    Cc: Miklos Szeredi
    Link: http://lkml.kernel.org/r/20200414150233.24495-17-willy@infradead.org
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     

06 Mar, 2020

1 commit

  • This adds the implementation of inode operations for exfat.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Sungjong Seo
    Reviewed-by: Pali Rohár
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Namjae Jeon