14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Jun, 2020

7 commits

  • Pull epoll update from Al Viro:
    "epoll conversion to read_iter from Jens; I thought there might be more
    epoll stuff this cycle, but uaccess took too much time"

    * 'work.epoll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    eventfd: convert to f_op->read_iter()

    Linus Torvalds
     
  • Pull vfs fixes from Al Viro:
    "A couple of trivial patches that fell through the cracks last cycle"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: fix indentation in deactivate_super()
    vfs: Remove duplicated d_mountpoint check in __is_local_mountpoint

    Linus Torvalds
     
  • Pull sysctl fixes from Al Viro:
    "Fixups to regressions in sysctl series"

    * 'work.sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    sysctl: reject gigantic reads/write to sysctl files
    cdrom: fix an incorrect __user annotation on cdrom_sysctl_info
    trace: fix an incorrect __user annotation on stack_trace_sysctl
    random: fix an incorrect __user annotation on proc_do_entropy
    net/sysctl: remove leftover __user annotations on neigh_proc_dointvec*
    net/sysctl: use cpumask_parse in flow_limit_cpu_sysctl

    Linus Torvalds
     
  • Pull misc uaccess updates from Al Viro:
    "Assorted uaccess patches for this cycle - the stuff that didn't fit
    into thematic series"

    * 'uaccess.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    bpf: make bpf_check_uarg_tail_zero() use check_zeroed_user()
    x86: kvm_hv_set_msr(): use __put_user() instead of 32bit __clear_user()
    user_regset_copyout_zero(): use clear_user()
    TEST_ACCESS_OK _never_ had been checked anywhere
    x86: switch cp_stat64() to unsafe_put_user()
    binfmt_flat: don't use __put_user()
    binfmt_elf_fdpic: don't use __... uaccess primitives
    binfmt_elf: don't bother with __{put,copy_to}_user()
    pselect6() and friends: take handling the combined 6th/7th args into helper

    Linus Torvalds
     
  • Pull proc fix from Eric Biederman:
    "Syzbot found a NULL pointer dereference if kzalloc of s_fs_info fails"

    * 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
    proc: s_fs_info may be NULL when proc_kill_sb is called

    Linus Torvalds
     
  • syzbot found that proc_fill_super() fails before filling up sb->s_fs_info,
    deactivate_locked_super() will be called and sb->s_fs_info will be NULL.
    The proc_kill_sb() does not expect fs_info to be NULL which is wrong.

    Link: https://lore.kernel.org/lkml/0000000000002d7ca605a7b8b1c5@google.com
    Reported-by: syzbot+4abac52934a48af5ff19@syzkaller.appspotmail.com
    Fixes: fa10fed30f25 ("proc: allow to mount many instances of proc in one pid namespace")
    Signed-off-by: Alexey Gladkov
    Signed-off-by: Eric W. Biederman

    Alexey Gladkov
     
  • Instead of triggering a WARN_ON deep down in the page allocator just
    give up early on allocations that are way larger than the usual sysctl
    values.

    Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
    Reported-by: Vegard Nossum
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

10 Jun, 2020

16 commits

  • Pull fuse updates from Miklos Szeredi:

    - Fix a rare deadlock in virtiofs

    - Fix st_blocks in writeback cache mode

    - Fix wrong checks in splice move causing spurious warnings

    - Fix a race between a GETATTR request and a FUSE_NOTIFY_INVAL_INODE
    notification

    - Use rb-tree instead of linear search for pages currently under
    writeout by userspace

    - Fix copy_file_range() inconsistencies

    * tag 'fuse-update-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
    fuse: copy_file_range should truncate cache
    fuse: fix copy_file_range cache issues
    fuse: optimize writepages search
    fuse: update attr_version counter on fuse_notify_inval_inode()
    fuse: don't check refcount after stealing page
    fuse: fix weird page warning
    fuse: use dump_page
    virtiofs: do not use fuse_fill_super_common() for device installation
    fuse: always allow query of st_dev
    fuse: always flush dirty data on close(2)
    fuse: invalidate inode attr in writeback cache mode
    fuse: Update stale comment in queue_interrupt()
    fuse: BUG_ON correction in fuse_dev_splice_write()
    virtiofs: Add mount option and atime behavior to the doc
    virtiofs: schedule blocking async replies in separate worker

    Linus Torvalds
     
  • Pull overlayfs updates from Miklos Szeredi:
    "Fixes:

    - Resolve mount option conflicts consistently

    - Sync before remount R/O

    - Fix file handle encoding corner cases

    - Fix metacopy related issues

    - Fix an unintialized return value

    - Add missing permission checks for underlying layers

    Optimizations:

    - Allow multipe whiteouts to share an inode

    - Optimize small writes by inheriting SB_NOSEC from upper layer

    - Do not call ->syncfs() multiple times for sync(2)

    - Do not cache negative lookups on upper layer

    - Make private internal mounts longterm"

    * tag 'ovl-update-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs: (27 commits)
    ovl: remove unnecessary lock check
    ovl: make oip->index bool
    ovl: only pass ->ki_flags to ovl_iocb_to_rwf()
    ovl: make private mounts longterm
    ovl: get rid of redundant members in struct ovl_fs
    ovl: add accessor for ofs->upper_mnt
    ovl: initialize error in ovl_copy_xattr
    ovl: drop negative dentry in upper layer
    ovl: check permission to open real file
    ovl: call secutiry hook in ovl_real_ioctl()
    ovl: verify permissions in ovl_path_open()
    ovl: switch to mounter creds in readdir
    ovl: pass correct flags for opening real directory
    ovl: fix redirect traversal on metacopy dentries
    ovl: initialize OVL_UPPERDATA in ovl_lookup()
    ovl: use only uppermetacopy state in ovl_lookup()
    ovl: simplify setting of origin for index lookup
    ovl: fix out of bounds access warning in ovl_check_fb_len()
    ovl: return required buffer size for file handles
    ovl: sync dirty data when remounting to ro mode
    ...

    Linus Torvalds
     
  • Pull AFS fixes from David Howells:
    "A set of small patches to fix some things, most of them minor.

    - Fix a memory leak in afs_put_sysnames()

    - Fix an oops in AFS file locking

    - Fix new use of BUG()

    - Fix debugging statements containing %px

    - Remove afs_zero_fid as it's unused

    - Make afs_zap_data() static"

    * tag 'afs-fixes-20200609' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
    afs: Make afs_zap_data() static
    afs: Remove afs_zero_fid as it's not used
    afs: Fix debugging statements with %px to be %p
    afs: Fix use of BUG()
    afs: Fix file locking
    afs: Fix memory leak in afs_put_sysnames()

    Linus Torvalds
     
  • Pull f2fs updates from Jaegeuk Kim:
    "In this round, we've added some knobs to enhance compression feature
    and harden testing environment. In addition, we've fixed several bugs
    reported from Android devices such as long discarding latency, device
    hanging during quota_sync, etc.

    Enhancements:
    - support lzo-rle algorithm
    - add two ioctls to release and reserve blocks for compression
    - support partial truncation/fiemap on compressed file
    - introduce sysfs entries to attach IO flags explicitly
    - add iostat trace point along with read io stat

    Bug fixes:
    - fix long discard latency
    - flush quota data by f2fs_quota_sync correctly
    - fix to recover parent inode number for power-cut recovery
    - fix lz4/zstd output buffer budget
    - parse checkpoint mount option correctly
    - avoid inifinite loop to wait for flushing node/meta pages
    - manage discard space correctly

    And some refactoring and clean up patches were added"

    * tag 'f2fs-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (51 commits)
    f2fs: attach IO flags to the missing cases
    f2fs: add node_io_flag for bio flags likewise data_io_flag
    f2fs: remove unused parameter of f2fs_put_rpages_mapping()
    f2fs: handle readonly filesystem in f2fs_ioc_shutdown()
    f2fs: avoid utf8_strncasecmp() with unstable name
    f2fs: don't return vmalloc() memory from f2fs_kmalloc()
    f2fs: fix retry logic in f2fs_write_cache_pages()
    f2fs: fix wrong discard space
    f2fs: compress: don't compress any datas after cp stop
    f2fs: remove unneeded return value of __insert_discard_tree()
    f2fs: fix wrong value of tracepoint parameter
    f2fs: protect new segment allocation in expand_inode_data
    f2fs: code cleanup by removing ifdef macro surrounding
    f2fs: avoid inifinite loop to wait for flushing node pages at cp_error
    f2fs: flush dirty meta pages when flushing them
    f2fs: fix checkpoint=disable:%u%%
    f2fs: compress: fix zstd data corruption
    f2fs: add compressed/gc data read IO stat
    f2fs: fix potential use-after-free issue
    f2fs: compress: don't handle non-compressed data in workqueue
    ...

    Linus Torvalds
     
  • 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
     
  • Make afs_zap_data() static as it's only used in the file in which it is
    defined.

    Signed-off-by: David Howells

    David Howells
     
  • Remove afs_zero_fid as it's not used.

    Signed-off-by: David Howells

    David Howells
     
  • Fix a couple of %px to be %p in debugging statements.

    Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
    Fixes: 8a070a964877 ("afs: Detect cell aliases 1 - Cells with root volumes")
    Reported-by: Kees Cook
    Signed-off-by: David Howells
    Reviewed-by: Kees Cook

    David Howells
     
  • …kernel/git/shuah/linux-kselftest

    Pull Kunit updates from Shuah Khan:
    "This consists of:

    - Several config fragment fixes from Anders Roxell to improve test
    coverage.

    - Improvements to kunit run script to use defconfig as default and
    restructure the code for config/build/exec/parse from Vitor Massaru
    Iha and David Gow.

    - Miscellaneous documentation warn fix"

    * tag 'linux-kselftest-kunit-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    security: apparmor: default KUNIT_* fragments to KUNIT_ALL_TESTS
    fs: ext4: default KUNIT_* fragments to KUNIT_ALL_TESTS
    drivers: base: default KUNIT_* fragments to KUNIT_ALL_TESTS
    lib: Kconfig.debug: default KUNIT_* fragments to KUNIT_ALL_TESTS
    kunit: default KUNIT_* fragments to KUNIT_ALL_TESTS
    kunit: Kconfig: enable a KUNIT_ALL_TESTS fragment
    kunit: Fix TabError, remove defconfig code and handle when there is no kunitconfig
    kunit: use KUnit defconfig by default
    kunit: use --build_dir=.kunit as default
    Documentation: test.h - fix warnings
    kunit: kunit_tool: Separate out config/build/exec/parse

    Linus Torvalds
     
  • Convert comments that reference mmap_sem to reference mmap_lock instead.

    [akpm@linux-foundation.org: fix up linux-next leftovers]
    [akpm@linux-foundation.org: s/lockaphore/lock/, per Vlastimil]
    [akpm@linux-foundation.org: more linux-next fixups, per Michel]

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Vlastimil Babka
    Reviewed-by: Daniel Jordan
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Laurent Dufour
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-13-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • Convert comments that reference old mmap_sem APIs to reference
    corresponding new mmap locking APIs instead.

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Vlastimil Babka
    Reviewed-by: Davidlohr Bueso
    Reviewed-by: Daniel Jordan
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Laurent Dufour
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-12-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • Add new APIs to assert that mmap_sem is held.

    Using this instead of rwsem_is_locked and lockdep_assert_held[_write]
    makes the assertions more tolerant of future changes to the lock type.

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Vlastimil Babka
    Reviewed-by: Daniel Jordan
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Laurent Dufour
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-10-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • Convert the last few remaining mmap_sem rwsem calls to use the new mmap
    locking API. These were missed by coccinelle for some reason (I think
    coccinelle does not support some of the preprocessor constructs in these
    files ?)

    [akpm@linux-foundation.org: convert linux-next leftovers]
    [akpm@linux-foundation.org: more linux-next leftovers]
    [akpm@linux-foundation.org: more linux-next leftovers]

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Daniel Jordan
    Reviewed-by: Laurent Dufour
    Reviewed-by: Vlastimil Babka
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • This change converts the existing mmap_sem rwsem calls to use the new mmap
    locking API instead.

    The change is generated using coccinelle with the following rule:

    // spatch --sp-file mmap_lock_api.cocci --in-place --include-headers --dir .

    @@
    expression mm;
    @@
    (
    -init_rwsem
    +mmap_init_lock
    |
    -down_write
    +mmap_write_lock
    |
    -down_write_killable
    +mmap_write_lock_killable
    |
    -down_write_trylock
    +mmap_write_trylock
    |
    -up_write
    +mmap_write_unlock
    |
    -downgrade_write
    +mmap_write_downgrade
    |
    -down_read
    +mmap_read_lock
    |
    -down_read_killable
    +mmap_read_lock_killable
    |
    -down_read_trylock
    +mmap_read_trylock
    |
    -up_read
    +mmap_read_unlock
    )
    -(&mm->mmap_sem)
    +(mm)

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Daniel Jordan
    Reviewed-by: Laurent Dufour
    Reviewed-by: Vlastimil Babka
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-5-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     
  • Patch series "mm: consolidate definitions of page table accessors", v2.

    The low level page table accessors (pXY_index(), pXY_offset()) are
    duplicated across all architectures and sometimes more than once. For
    instance, we have 31 definition of pgd_offset() for 25 supported
    architectures.

    Most of these definitions are actually identical and typically it boils
    down to, e.g.

    static inline unsigned long pmd_index(unsigned long address)
    {
    return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
    }

    static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
    {
    return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
    }

    These definitions can be shared among 90% of the arches provided
    XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.

    For architectures that really need a custom version there is always
    possibility to override the generic version with the usual ifdefs magic.

    These patches introduce include/linux/pgtable.h that replaces
    include/asm-generic/pgtable.h and add the definitions of the page table
    accessors to the new header.

    This patch (of 12):

    The linux/mm.h header includes to allow inlining of the
    functions involving page table manipulations, e.g. pte_alloc() and
    pmd_alloc(). So, there is no point to explicitly include
    in the files that include .

    The include statements in such cases are remove with a simple loop:

    for f in $(git grep -l "include ") ; do
    sed -i -e '/include / d' $f
    done

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Brian Cain
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Ungerer
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Ingo Molnar
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Matthew Wilcox
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Mike Rapoport
    Cc: Nick Hu
    Cc: Paul Walmsley
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vincent Chen
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
    Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Fix afs_compare_addrs() to use WARN_ON(1) instead of BUG() and return 1
    (ie. srx_a > srx_b).

    There's no point trying to put actual error handling in as this should not
    occur unless a new transport address type is allowed by AFS. And even if
    it does, in this particular case, it'll just never match unknown types of
    addresses. This BUG() was more of a 'you need to add a case here'
    indicator.

    Reported-by: Kees Cook
    Signed-off-by: David Howells
    Reviewed-by: Kees Cook

    David Howells
     

09 Jun, 2020

16 commits

  • Fix AFS file locking to use the correct vnode pointer and remove a member
    of the afs_operation struct that is never set, but it is read and followed,
    causing an oops.

    This can be triggered by:

    flock -s /afs/example.com/foo sleep 1

    when it calls the kernel to get a file lock.

    Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
    Reported-by: Dave Botsch
    Signed-off-by: David Howells
    Tested-by: Dave Botsch

    David Howells
     
  • Fix afs_put_sysnames() to actually free the specified afs_sysnames
    object after its reference count has been decreased to zero and
    its contents have been released.

    Fixes: 6f8880d8e681557 ("afs: Implement @sys substitution handling")
    Signed-off-by: Zhihao Cheng
    Signed-off-by: David Howells

    Zhihao Cheng
     
  • This code calls brelse(bh) and then dereferences "bh" on the next line
    resulting in a possible use after free. The brelse() should just be
    moved down a line.

    Fixes: b676fdbcf4c8 ("exfat: standardize checksum calculation")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Namjae Jeon

    Dan Carpenter
     
  • There is check error in range condition that can never be entered
    even with invalid input.
    Replace incorrent checking code with already existing valid checker.

    Signed-off-by: hyeongseok.kim
    Acked-by: Sungjong Seo
    Signed-off-by: Namjae Jeon

    hyeongseok.kim
     
  • At truncate, there is a problem of incorrect updating in the file entry
    pointer instead of stream entry. This will cause the problem of
    overwriting the time field of the file entry to new_size. Fix it to
    update stream entry.

    Fixes: 98d917047e8b ("exfat: add file operations")
    Cc: stable@vger.kernel.org # v5.7
    Signed-off-by: Namjae Jeon

    Namjae Jeon
     
  • butt3rflyh4ck reported memory leak found by syzkaller.

    A param->string held by exfat_mount_options.

    BUG: memory leak

    unreferenced object 0xffff88801972e090 (size 8):
    comm "syz-executor.2", pid 16298, jiffies 4295172466 (age 14.060s)
    hex dump (first 8 bytes):
    6b 6f 69 38 2d 75 00 00 koi8-u..
    backtrace:
    [] kstrdup+0x36/0x70 mm/util.c:60
    [] exfat_parse_param+0x160/0x5e0
    fs/exfat/super.c:276
    [] vfs_parse_fs_param+0x2b4/0x610
    fs/fs_context.c:147
    [] vfs_parse_fs_string+0xe6/0x150
    fs/fs_context.c:191
    [] generic_parse_monolithic+0x16f/0x1f0
    fs/fs_context.c:231
    [] do_new_mount fs/namespace.c:2812 [inline]
    [] do_mount+0x12bb/0x1b30 fs/namespace.c:3141
    [] __do_sys_mount fs/namespace.c:3350 [inline]
    [] __se_sys_mount fs/namespace.c:3327 [inline]
    [] __x64_sys_mount+0x18f/0x230 fs/namespace.c:3327
    [] do_syscall_64+0xf6/0x7d0
    arch/x86/entry/common.c:295
    [] entry_SYSCALL_64_after_hwframe+0x49/0xb3

    exfat_free() should call exfat_free_iocharset(), to prevent a leak
    in case we fail after parsing iocharset= but before calling
    get_tree_bdev().

    Additionally, there's no point copying param->string in
    exfat_parse_param() - just steal it, leaving NULL in param->string.
    That's independent from the leak or fix thereof - it's simply
    avoiding an extra copy.

    Fixes: 719c1e182916 ("exfat: add super block operations")
    Cc: stable@vger.kernel.org # v5.7
    Reported-by: butt3rflyh4ck
    Signed-off-by: Al Viro
    Signed-off-by: Namjae Jeon

    Al Viro
     
  • kbuild test robot reported :

    fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len'
    is reassigned a value before the old one has been used.

    The reassignment of p_uniname->name_len is not needed and remove it.

    Reported-by: kbuild test robot
    Signed-off-by: Namjae Jeon

    Namjae Jeon
     
  • To clarify that it is a 16-bit checksum, the parts related to the 16-bit
    checksum are renamed and change type to u16.
    Furthermore, replace checksum calculation in exfat_load_upcase_table()
    with exfat_calc_checksum32().

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

    Tetsuhiro Kohada
     
  • Add Boot-Regions verification specified in exFAT specification.
    Note that the checksum type is strongly related to the raw structure,
    so the'u32 'type is used to clarify the number of bits.

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

    Tetsuhiro Kohada
     
  • Separate the boot sector analysis to read_boot_sector().
    And add a check for the fs_name field.
    Furthermore, add a strict consistency check, because overlapping areas
    can cause serious corruption.

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

    Tetsuhiro Kohada
     
  • Aggregate PBR related definitions and redefine as "boot_sector" to comply
    with the exFAT specification.
    And, rename variable names including 'pbr'.

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

    Tetsuhiro Kohada
     
  • 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
     
  • There is no need to init 'sync' in exfat_set_vol_flags().
    This also fixes the following coccicheck warning:

    fs/exfat/super.c:104:6-10: WARNING: Assignment of 0/1 to bool variable

    Signed-off-by: Jason Yan
    Signed-off-by: Namjae Jeon

    Jason Yan
     
  • After applying previous two patches, these functions are not used anymore.

    Signed-off-by: Pali Rohár
    Signed-off-by: Namjae Jeon

    Pali Rohár
     
  • Function partial_name_hash() takes long type value into which can be stored
    one Unicode code point. Therefore conversion from UTF-32 to UTF-16 is not
    needed.

    Signed-off-by: Pali Rohár
    Signed-off-by: Namjae Jeon

    Pali Rohár