20 Mar, 2020

1 commit


05 Feb, 2020

1 commit

  • Pull vfs timestamp updates from Al Viro:
    "More 64bit timestamp work"

    * 'imm.timestamp' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    kernfs: don't bother with timestamp truncation
    fs: Do not overload update_time
    fs: Delete timespec64_trunc()
    fs: ubifs: Eliminate timespec64_trunc() usage
    fs: ceph: Delete timespec64_trunc() usage
    fs: cifs: Delete usage of timespec64_trunc
    fs: fat: Eliminate timespec64_trunc() usage
    utimes: Clamp the timestamps in notify_change()

    Linus Torvalds
     

31 Jan, 2020

1 commit

  • Pull UBI/UBIFS updates from Miquel Raynal:
    "This pull request contains mostly fixes for UBI and UBIFS:

    UBI:
    - Fixes for memory leaks in error paths
    - Fix for an logic error in a fastmap selfcheck

    UBIFS:
    - Fix for FS_IOC_SETFLAGS related to fscrypt flag
    - Support for FS_ENCRYPT_FL
    - Fix for a dead lock in bulk-read mode"

    Sent on behalf of Richard Weinberger who is traveling.

    * tag 'upstream-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
    ubi: Fix an error pointer dereference in error handling code
    ubifs: Fix memory leak from c->sup_node
    ubifs: Fix ino_t format warnings in orphan_delete()
    ubifs: Fix deadlock in concurrent bulk-read and writepage
    ubifs: Fix wrong memory allocation
    ubi: Free the normal volumes in error paths of ubi_attach_mtd_dev()
    ubi: Check the presence of volume before call ubi_fastmap_destroy_checkmap()
    ubifs: Add support for FS_ENCRYPT_FL
    ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag
    ubi: wl: Remove set but not used variable 'prev_e'
    ubi: fastmap: Fix inverted logic in seen selfcheck

    Linus Torvalds
     

23 Jan, 2020

2 commits

  • In order to support a new dirhash method that is a secret-keyed hash
    over the plaintext filenames (which will be used by encrypted+casefolded
    directories on ext4 and f2fs), fscrypt will be switching to a new no-key
    name format that always encodes the dirhash in the name.

    UBIFS isn't happy with this because it has assertions that verify that
    either the hash or the disk name is provided, not both.

    Change it to use the disk name if one is provided, even if a hash is
    available too; else use the hash.

    Link: https://lore.kernel.org/r/20200120223201.241390-6-ebiggers@kernel.org
    Signed-off-by: Eric Biggers

    Eric Biggers
     
  • If userspace provides an invalid fscrypt no-key filename which encodes a
    hash value with any of the UBIFS node type bits set (i.e. the high 3
    bits), gracefully report ENOENT rather than triggering ubifs_assert().

    Test case with kvm-xfstests shell:

    . fs/ubifs/config
    . ~/xfstests/common/encrypt
    dev=$(__blkdev_to_ubi_volume /dev/vdc)
    ubiupdatevol $dev -t
    mount $dev /mnt -t ubifs
    mkdir /mnt/edir
    xfs_io -c set_encpolicy /mnt/edir
    rm /mnt/edir/_,,,,,DAAAAAAAAAAAAAAAAAAAAAAAAAA

    With the bug, the following assertion fails on the 'rm' command:

    [ 19.066048] UBIFS error (ubi0:0 pid 379): ubifs_assert_failed: UBIFS assert failed: !(hash & ~UBIFS_S_KEY_HASH_MASK), in fs/ubifs/key.h:170

    Fixes: f4f61d2cc6d8 ("ubifs: Implement encrypted filenames")
    Cc: # v4.10+
    Link: https://lore.kernel.org/r/20200120223201.241390-5-ebiggers@kernel.org
    Signed-off-by: Eric Biggers

    Eric Biggers
     

21 Jan, 2020

1 commit

  • There's no need for the ubifs_crypt_is_encrypted() function anymore.
    Just use IS_ENCRYPTED() instead, like ext4 and f2fs do. IS_ENCRYPTED()
    checks the VFS-level flag instead of the UBIFS-specific flag, but it
    shouldn't change any behavior since the flags are kept in sync.

    Link: https://lore.kernel.org/r/20191209212721.244396-1-ebiggers@kernel.org
    Acked-by: Richard Weinberger
    Signed-off-by: Eric Biggers

    Eric Biggers
     

20 Jan, 2020

1 commit

  • The c->sup_node is allocated in function ubifs_read_sb_node but
    is not freed. This will cause memory leak as below:

    unreferenced object 0xbc9ce000 (size 4096):
    comm "mount", pid 500, jiffies 4294952946 (age 315.820s)
    hex dump (first 32 bytes):
    31 18 10 06 06 7b f1 11 02 00 00 00 00 00 00 00 1....{..........
    00 10 00 00 06 00 00 00 00 00 00 00 08 00 00 00 ................
    backtrace:
    [] ubifs_read_superblock+0x48/0xebc
    [] ubifs_mount+0x974/0x1420
    [] legacy_get_tree+0x2c/0x50
    [] vfs_get_tree+0x28/0xfc
    [] do_mount+0x4f8/0x748
    [] ksys_mount+0x78/0xa0
    [] ret_fast_syscall+0x0/0x54
    [] 0x7ea02790

    Free it in ubifs_umount and in the error path of mount_ubifs.

    Fixes: fd6150051bec ("ubifs: Store read superblock node")
    Signed-off-by: Quanyang Wang
    Signed-off-by: Richard Weinberger

    Quanyang Wang
     

17 Jan, 2020

5 commits

  • On alpha and s390x:

    fs/ubifs/debug.h:158:11: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t {aka unsigned int}’ [-Wformat=]
    ...
    fs/ubifs/orphan.c:132:3: note: in expansion of macro ‘dbg_gen’
    dbg_gen("deleted twice ino %lu", orph->inum);
    ...
    fs/ubifs/orphan.c:140:3: note: in expansion of macro ‘dbg_gen’
    dbg_gen("delete later ino %lu", orph->inum);

    __kernel_ino_t is "unsigned long" on most architectures, but not on
    alpha and s390x, where it is "unsigned int". Hence when printing an
    ino_t, it should always be cast to "unsigned long" first.

    Fix this by re-adding the recently removed casts.

    Fixes: 8009ce956c3d2802 ("ubifs: Don't leak orphans on memory during commit")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Richard Weinberger

    Geert Uytterhoeven
     
  • In ubifs, concurrent execution of writepage and bulk read on the same file
    may cause ABBA deadlock, for example (Reproduce method see Link):

    Process A(Bulk-read starts from page4) Process B(write page4 back)
    vfs_read wb_workfn or fsync
    ... ...
    generic_file_buffered_read write_cache_pages
    ubifs_readpage LOCK(page4)

    ubifs_bulk_read ubifs_writepage
    LOCK(ui->ui_mutex) ubifs_write_inode

    ubifs_do_bulk_read LOCK(ui->ui_mutex)
    find_or_create_page(alloc page4) ↑
    LOCK(page4) ui_mutex' in ubifs_bulk_read(). Instead, we
    allow ubifs_do_bulk_read() to lock page failed by replacing
    find_or_create_page(FGP_LOCK) with
    pagecache_get_page(FGP_LOCK | FGP_NOWAIT).

    Signed-off-by: Zhihao Cheng
    Suggested-by: zhangyi (F)
    Cc:
    Fixes: 4793e7c5e1c ("UBIFS: add bulk-read facility")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206153
    Signed-off-by: Richard Weinberger

    Zhihao Cheng
     
  • In create_default_filesystem() when we allocate the idx node we must use
    the idx_node_size we calculated just one line before, not tmp, which
    contains completely other data.

    Fixes: c4de6d7e4319 ("ubifs: Refactor create_default_filesystem()")
    Cc: stable@vger.kernel.org # v4.20+
    Reported-by: Naga Sureshkumar Relli
    Tested-by: Naga Sureshkumar Relli
    Signed-off-by: Sascha Hauer
    Signed-off-by: Richard Weinberger

    Sascha Hauer
     
  • Make the FS_IOC_GETFLAGS ioctl on ubifs return the FS_ENCRYPT_FL flag on
    encrypted files, like ext4 and f2fs do.

    Also make this flag be ignored by FS_IOC_SETFLAGS, like ext4 and f2fs
    do, since it's a recognized flag but is not directly settable.

    Signed-off-by: Eric Biggers
    Signed-off-by: Richard Weinberger

    Eric Biggers
     
  • UBIFS's implementation of FS_IOC_SETFLAGS fails to preserve existing
    inode flags that aren't settable by FS_IOC_SETFLAGS, namely the encrypt
    flag. This causes the encrypt flag to be unexpectedly cleared.

    Fix it by preserving existing unsettable flags, like ext4 and f2fs do.

    Test case with kvm-xfstests shell:

    FSTYP=ubifs KEYCTL_PROG=keyctl
    . fs/ubifs/config
    . ~/xfstests/common/encrypt
    dev=$(__blkdev_to_ubi_volume /dev/vdc)
    ubiupdatevol -t $dev
    mount $dev /mnt -t ubifs
    k=$(_generate_session_encryption_key)
    mkdir /mnt/edir
    xfs_io -c "set_encpolicy $k" /mnt/edir
    echo contents > /mnt/edir/file
    chattr +i /mnt/edir/file
    chattr -i /mnt/edir/file

    With the bug, the following errors occur on the last command:

    [ 18.081559] fscrypt (ubifs, inode 67): Inconsistent encryption context (parent directory: 65)
    chattr: Operation not permitted while reading flags on /mnt/edir/file

    Fixes: d475a507457b ("ubifs: Add skeleton for fscrypto")
    Cc: # v4.10+
    Signed-off-by: Eric Biggers
    Signed-off-by: Richard Weinberger

    Eric Biggers
     

01 Jan, 2020

2 commits

  • The commit 643fa9612bf1 ("fscrypt: remove filesystem specific
    build config option") removed modular support for fs/crypto. This
    causes the Crypto API to be built-in whenever fscrypt is enabled.
    This makes it very difficult for me to test modular builds of
    the Crypto API without disabling fscrypt which is a pain.

    As fscrypt is still evolving and it's developing new ties with the
    fs layer, it's hard to build it as a module for now.

    However, the actual algorithms are not required until a filesystem
    is mounted. Therefore we can allow them to be built as modules.

    Signed-off-by: Herbert Xu
    Link: https://lore.kernel.org/r/20191227024700.7vrzuux32uyfdgum@gondor.apana.org.au
    Signed-off-by: Eric Biggers

    Herbert Xu
     
  • fscrypt_get_encryption_info() returns 0 if the encryption key is
    unavailable; it never returns ENOKEY. So remove checks for ENOKEY.

    Link: https://lore.kernel.org/r/20191209212348.243331-1-ebiggers@kernel.org
    Signed-off-by: Eric Biggers

    Eric Biggers
     

09 Dec, 2019

2 commits

  • DEFAULT_TIME_GRAN is seconds granularity. We can
    just drop the nsec while creating the default root node.
    Delete the unneeded call to timespec64_trunc().

    Also update the ktime_get_* api to match the one used in
    current_time(). This allows for the timestamps to be updated
    by using the same ktime_get_* api always.

    Signed-off-by: Deepa Dinamani
    Cc: richard@nod.at
    Cc: linux-mtd@lists.infradead.org
    Signed-off-by: Al Viro

    Deepa Dinamani
     
  • Push clamping timestamps into notify_change(), so in-kernel
    callers like nfsd and overlayfs will get similar timestamp
    set behavior as utimes.

    AV: get rid of clamping in ->setattr() instances; we don't need
    to bother with that there, with notify_change() doing normalization
    in all cases now (it already did for implicit case, since current_time()
    clamps).

    Suggested-by: Miklos Szeredi
    Fixes: 42e729b9ddbb ("utimes: Clamp the timestamps before update")
    Cc: stable@vger.kernel.org # v5.4
    Cc: Deepa Dinamani
    Cc: Jeff Layton
    Signed-off-by: Amir Goldstein
    Signed-off-by: Al Viro

    Amir Goldstein
     

18 Nov, 2019

7 commits

  • Running stress-test test_2 in mtd-utils on ubi device, sometimes we can
    get following oops message:

    BUG: unable to handle page fault for address: ffffffff00000140
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    PGD 280a067 P4D 280a067 PUD 0
    Oops: 0000 [#1] SMP
    CPU: 0 PID: 60 Comm: kworker/u16:1 Kdump: loaded Not tainted 5.2.0 #13
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0
    -0-ga698c8995f-prebuilt.qemu.org 04/01/2014
    Workqueue: writeback wb_workfn (flush-ubifs_0_0)
    RIP: 0010:rb_next_postorder+0x2e/0xb0
    Code: 80 db 03 01 48 85 ff 0f 84 97 00 00 00 48 8b 17 48 83 05 bc 80 db
    03 01 48 83 e2 fc 0f 84 82 00 00 00 48 83 05 b2 80 db 03 01 3b 7a
    10 48 89 d0 74 02 f3 c3 48 8b 52 08 48 83 05 a3 80 db 03
    RSP: 0018:ffffc90000887758 EFLAGS: 00010202
    RAX: ffff888129ae4700 RBX: ffff888138b08400 RCX: 0000000080800001
    RDX: ffffffff00000130 RSI: 0000000080800024 RDI: ffff888138b08400
    RBP: ffff888138b08400 R08: ffffea0004a6b920 R09: 0000000000000000
    R10: ffffc90000887740 R11: 0000000000000001 R12: ffff888128d48000
    R13: 0000000000000800 R14: 000000000000011e R15: 00000000000007c8
    FS: 0000000000000000(0000) GS:ffff88813ba00000(0000)
    knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffff00000140 CR3: 000000013789d000 CR4: 00000000000006f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    destroy_old_idx+0x5d/0xa0 [ubifs]
    ubifs_tnc_start_commit+0x4fe/0x1380 [ubifs]
    do_commit+0x3eb/0x830 [ubifs]
    ubifs_run_commit+0xdc/0x1c0 [ubifs]

    Above Oops are due to the slab-out-of-bounds happened in do-while of
    function layout_in_gaps indirectly called by ubifs_tnc_start_commit. In
    function layout_in_gaps, there is a do-while loop placing index nodes
    into the gaps created by obsolete index nodes in non-empty index LEBs
    until rest index nodes can totally be placed into pre-allocated empty
    LEBs. @c->gap_lebs points to a memory area(integer array) which records
    LEB numbers used by 'in-the-gaps' method. Whenever a fitable index LEB
    is found, corresponding lnum will be incrementally written into the
    memory area pointed by @c->gap_lebs. The size
    ((@c->lst.idx_lebs + 1) * sizeof(int)) of memory area is allocated before
    do-while loop and can not be changed in the loop. But @c->lst.idx_lebs
    could be increased by function ubifs_change_lp (called by
    layout_leb_in_gaps->ubifs_find_dirty_idx_leb->get_idx_gc_leb) during the
    loop. So, sometimes oob happens when number of cycles in do-while loop
    exceeds the original value of @c->lst.idx_lebs. See detail in
    https://bugzilla.kernel.org/show_bug.cgi?id=204229.
    This patch fixes oob in layout_in_gaps.

    Signed-off-by: Zhihao Cheng
    Signed-off-by: Richard Weinberger

    Zhihao Cheng
     
  • If there are more than one valid snod on the sleb->nodes list,
    do_kill_orphans will malloc ino more than once without releasing
    previous ino's memory. Finally, it will trigger memory leak.

    Fixes: ee1438ce5dc4 ("ubifs: Check link count of inodes when...")
    Signed-off-by: Zhihao Cheng
    Signed-off-by: zhangyi (F)
    Signed-off-by: Richard Weinberger

    Zhihao Cheng
     
  • This reverts commit 9163e0184bd7d5f779934d34581843f699ad2ffd.

    At the point when ubifs_fill_super() runs, we have already a reference
    to the super block. So upon deactivate_locked_super() c will get
    free()'ed via ->kill_sb().

    Cc: Wenwen Wang
    Fixes: 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")
    Reported-by: https://twitter.com/grsecurity/status/1180609139359277056
    Signed-off-by: Richard Weinberger
    Tested-by: Romain Izard
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • The sup->hash_algo is a __le16, and whilst 0xffff is
    the same in __le16 and u16, it would be better to use
    cpu_to_le16() anyway (which should deal with constants)
    and silence the following sparse warning:

    fs/ubifs/sb.c:187:32: warning: incorrect type in assignment (different base types)
    fs/ubifs/sb.c:187:32: expected restricted __le16 [usertype] hash_algo
    fs/ubifs/sb.c:187:32: got int

    Signed-off-by: Ben Dooks
    Signed-off-by: Richard Weinberger

    Ben Dooks (Codethink)
     
  • In the ubifs_jnl_write_inode() functon, it calls ubifs_iget()
    with xent->inum. The xent->inum is __le64, but the ubifs_iget()
    takes native cpu endian.

    I think that this should be changed to passing le64_to_cpu(xent->inum)
    to fix the following sparse warning:

    fs/ubifs/journal.c:902:58: warning: incorrect type in argument 2 (different base types)
    fs/ubifs/journal.c:902:58: expected unsigned long inum
    fs/ubifs/journal.c:902:58: got restricted __le64 [usertype] inum

    Fixes: 7959cf3a7506 ("ubifs: journal: Handle xattrs like files")
    Signed-off-by: Ben Dooks
    Signed-off-by: Richard Weinberger

    Ben Dooks (Codethink)
     
  • In set_dent_cookie() the result of prandom_u32() is
    assinged to an __le32 type. Make this a forced conversion
    to remove the following sparse warning:

    fs/ubifs/journal.c:506:30: warning: incorrect type in assignment (different base types)
    fs/ubifs/journal.c:506:30: expected restricted __le32 [usertype] cookie
    fs/ubifs/journal.c:506:30: got unsigned int

    Signed-off-by: Ben Dooks
    Signed-off-by: Richard Weinberger

    Ben Dooks (Codethink)
     
  • AFAICT this kind of problems are no longer possible since
    debugfs gained file removal protection via
    e9117a5a4bf6 ("debugfs: implement per-file removal protection").

    Cc: Christoph Hellwig
    Cc: Nicolai Stange
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

22 Sep, 2019

1 commit

  • Pull UBI, UBIFS and JFFS2 updates from Richard Weinberger:
    "UBI:
    - Be less stupid when placing a fastmap anchor
    - Try harder to get an empty PEB in case of contention
    - Make ubiblock to warn if image is not a multiple of 512

    UBIFS:
    - Various fixes in error paths

    JFFS2:
    - Various fixes in error paths"

    * tag 'upstream-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
    jffs2: Fix memory leak in jffs2_scan_eraseblock() error path
    jffs2: Remove jffs2_gc_fetch_page and jffs2_gc_release_page
    jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()
    ubi: block: Warn if volume size is not multiple of 512
    ubifs: Fix memory leak bug in alloc_ubifs_info() error path
    ubifs: Fix memory leak in __ubifs_node_verify_hmac error path
    ubifs: Fix memory leak in read_znode() error path
    ubi: ubi_wl_get_peb: Increase the number of attempts while getting PEB
    ubi: Don't do anchor move within fastmap area
    ubifs: Remove redundant assignment to pointer fname

    Linus Torvalds
     

20 Sep, 2019

1 commit

  • Pull y2038 vfs updates from Arnd Bergmann:
    "Add inode timestamp clamping.

    This series from Deepa Dinamani adds a per-superblock minimum/maximum
    timestamp limit for a file system, and clamps timestamps as they are
    written, to avoid random behavior from integer overflow as well as
    having different time stamps on disk vs in memory.

    At mount time, a warning is now printed for any file system that can
    represent current timestamps but not future timestamps more than 30
    years into the future, similar to the arbitrary 30 year limit that was
    added to settimeofday().

    This was picked as a compromise to warn users to migrate to other file
    systems (e.g. ext4 instead of ext3) when they need the file system to
    survive beyond 2038 (or similar limits in other file systems), but not
    get in the way of normal usage"

    * tag 'y2038-vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground:
    ext4: Reduce ext4 timestamp warnings
    isofs: Initialize filesystem timestamp ranges
    pstore: fs superblock limits
    fs: omfs: Initialize filesystem timestamp ranges
    fs: hpfs: Initialize filesystem timestamp ranges
    fs: ceph: Initialize filesystem timestamp ranges
    fs: sysv: Initialize filesystem timestamp ranges
    fs: affs: Initialize filesystem timestamp ranges
    fs: fat: Initialize filesystem timestamp ranges
    fs: cifs: Initialize filesystem timestamp ranges
    fs: nfs: Initialize filesystem timestamp ranges
    ext4: Initialize timestamps limits
    9p: Fill min and max timestamps in sb
    fs: Fill in max and min timestamps in superblock
    utimes: Clamp the timestamps before update
    mount: Add mount warning for impending timestamp expiry
    timestamp_truncate: Replace users of timespec64_trunc
    vfs: Add timestamp_truncate() api
    vfs: Add file timestamp range support

    Linus Torvalds
     

19 Sep, 2019

1 commit

  • Pull fscrypt updates from Eric Biggers:
    "This is a large update to fs/crypto/ which includes:

    - Add ioctls that add/remove encryption keys to/from a
    filesystem-level keyring.

    These fix user-reported issues where e.g. an encrypted home
    directory can break NetworkManager, sshd, Docker, etc. because they
    don't get access to the needed keyring. These ioctls also provide a
    way to lock encrypted directories that doesn't use the
    vm.drop_caches sysctl, so is faster, more reliable, and doesn't
    always need root.

    - Add a new encryption policy version ("v2") which switches to a more
    standard, secure, and flexible key derivation function, and starts
    verifying that the correct key was supplied before using it.

    The key derivation improvement is needed for its own sake as well
    as for ongoing feature work for which the current way is too
    inflexible.

    Work is in progress to update both Android and the 'fscrypt' userspace
    tool to use both these features. (Working patches are available and
    just need to be reviewed+merged.) Chrome OS will likely use them too.

    This has also been tested on ext4, f2fs, and ubifs with xfstests --
    both the existing encryption tests, and the new tests for this. This
    has also been in linux-next since Aug 16 with no reported issues. I'm
    also using an fscrypt v2-encrypted home directory on my personal
    desktop"

    * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt: (27 commits)
    ext4 crypto: fix to check feature status before get policy
    fscrypt: document the new ioctls and policy version
    ubifs: wire up new fscrypt ioctls
    f2fs: wire up new fscrypt ioctls
    ext4: wire up new fscrypt ioctls
    fscrypt: require that key be added when setting a v2 encryption policy
    fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS ioctl
    fscrypt: allow unprivileged users to add/remove keys for v2 policies
    fscrypt: v2 encryption policy support
    fscrypt: add an HKDF-SHA512 implementation
    fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl
    fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl
    fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl
    fscrypt: rename keyinfo.c to keysetup.c
    fscrypt: move v1 policy key setup to keysetup_v1.c
    fscrypt: refactor key setup code in preparation for v2 policies
    fscrypt: rename fscrypt_master_key to fscrypt_direct_key
    fscrypt: add ->ci_inode to fscrypt_info
    fscrypt: use FSCRYPT_* definitions, not FS_*
    fscrypt: use FSCRYPT_ prefix for uapi constants
    ...

    Linus Torvalds
     

16 Sep, 2019

4 commits

  • In ubifs_mount(), 'c' is allocated through kzalloc() in alloc_ubifs_info().
    However, it is not deallocated in the following execution if
    ubifs_fill_super() fails, leading to a memory leak bug. To fix this issue,
    free 'c' before going to the 'out_deact' label.

    Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
    Signed-off-by: Wenwen Wang
    Signed-off-by: Richard Weinberger

    Wenwen Wang
     
  • In __ubifs_node_verify_hmac(), 'hmac' is allocated through kmalloc().
    However, it is not deallocated in the following execution if
    ubifs_node_calc_hmac() fails, leading to a memory leak bug. To fix this
    issue, free 'hmac' before returning the error.

    Fixes: 49525e5eecca ("ubifs: Add helper functions for authentication support")
    Signed-off-by: Wenwen Wang
    Signed-off-by: Richard Weinberger

    Wenwen Wang
     
  • In read_znode(), the indexing node 'idx' is allocated by kmalloc().
    However, it is not deallocated in the following execution if
    ubifs_node_check_hash() fails, leading to a memory leak bug. To fix this
    issue, free 'idx' before returning the error.

    Fixes: 16a26b20d2af ("ubifs: authentication: Add hashes to index nodes")
    Signed-off-by: Wenwen Wang
    Signed-off-by: Richard Weinberger

    Wenwen Wang
     
  • The pointer fname is being assigned with a value that is never
    read because the function returns after the assignment. The assignment
    is redundant and can be removed.

    Addresses-Coverity: ("Unused value")
    Signed-off-by: Colin Ian King
    Signed-off-by: Richard Weinberger

    Colin Ian King
     

30 Aug, 2019

1 commit

  • Update the inode timestamp updates to use timestamp_truncate()
    instead of timespec64_trunc().

    The change was mostly generated by the following coccinelle
    script.

    virtual context
    virtual patch

    @r1 depends on patch forall@
    struct inode *inode;
    identifier i_xtime =~ "^i_[acm]time$";
    expression e;
    @@

    inode->i_xtime =
    - timespec64_trunc(
    + timestamp_truncate(
    ...,
    - e);
    + inode);

    Signed-off-by: Deepa Dinamani
    Acked-by: Greg Kroah-Hartman
    Acked-by: Jeff Layton
    Cc: adrian.hunter@intel.com
    Cc: dedekind1@gmail.com
    Cc: gregkh@linuxfoundation.org
    Cc: hch@lst.de
    Cc: jaegeuk@kernel.org
    Cc: jlbec@evilplan.org
    Cc: richard@nod.at
    Cc: tj@kernel.org
    Cc: yuchao0@huawei.com
    Cc: linux-f2fs-devel@lists.sourceforge.net
    Cc: linux-ntfs-dev@lists.sourceforge.net
    Cc: linux-mtd@lists.infradead.org

    Deepa Dinamani
     

22 Aug, 2019

3 commits

  • If the number of dirty pages to be written back is large,
    then writeback_inodes_sb will block waiting for a long time,
    causing hung task detection alarm. Therefore, we should limit
    the maximum number of pages written back this time, which let
    the budget be completed faster. The remaining dirty pages
    tend to rely on the writeback mechanism to complete the
    synchronization.

    Fixes: b6e51316daed ("writeback: separate starting of sync vs opportunistic writeback")
    Signed-off-by: Liu Song
    Signed-off-by: Richard Weinberger

    Liu Song
     
  • Currently on a freshly mounted UBIFS, c->min_log_bytes is 0.
    This can lead to a log overrun and make commits fail.

    Recent kernels will report the following assert:
    UBIFS assert failed: c->lhead_lnum != c->ltail_lnum, in fs/ubifs/log.c:412

    c->min_log_bytes can have two states, 0 and c->leb_size.
    It controls how much bytes of the log area are reserved for non-bud
    nodes such as commit nodes.

    After a commit it has to be set to c->leb_size such that we have always
    enough space for a commit. While a commit runs it can be 0 to make the
    remaining bytes of the log available to writers.

    Having it set to 0 right after mount is wrong since no space for commits
    is reserved.

    Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
    Reported-and-tested-by: Uwe Kleine-König
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • We unlock after orphan_delete(), so no need to unlock
    in the function too.

    Reported-by: Han Xu
    Fixes: 8009ce956c3d ("ubifs: Don't leak orphans on memory during commit")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     

13 Aug, 2019

1 commit

  • Wire up the new ioctls for adding and removing fscrypt keys to/from the
    filesystem, and the new ioctl for retrieving v2 encryption policies.

    The key removal ioctls also required making UBIFS use
    fscrypt_drop_inode().

    For more details see Documentation/filesystems/fscrypt.rst and the
    fscrypt patches that added the implementation of these ioctls.

    Reviewed-by: Theodore Ts'o
    Signed-off-by: Eric Biggers

    Eric Biggers
     

19 Jul, 2019

1 commit

  • migrate_page_move_mapping() doesn't use the mode argument. Remove it
    and update callers accordingly.

    Link: http://lkml.kernel.org/r/20190508210301.8472-1-keith.busch@intel.com
    Signed-off-by: Keith Busch
    Reviewed-by: Zi Yan
    Cc: Mel Gorman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Keith Busch
     

15 Jul, 2019

1 commit

  • Pull UBIFS updates from Richard Weinberger:

    - Support for zstd compression

    - Support for offline signed filesystems

    - Various fixes for regressions

    * tag 'upstream-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
    ubifs: Don't leak orphans on memory during commit
    ubifs: Check link count of inodes when killing orphans.
    ubifs: Add support for zstd compression.
    ubifs: support offline signed images
    ubifs: remove unnecessary check in ubifs_log_start_commit
    ubifs: Fix typo of output in get_cs_sqnum
    ubifs: Simplify redundant code
    ubifs: Correctly use tnc_next() in search_dh_cookie()

    Linus Torvalds
     

13 Jul, 2019

2 commits

  • Pull common SETFLAGS/FSSETXATTR parameter checking from Darrick Wong:
    "Here's a patch series that sets up common parameter checking functions
    for the FS_IOC_SETFLAGS and FS_IOC_FSSETXATTR ioctl implementations.

    The goal here is to reduce the amount of behaviorial variance between
    the filesystems where those ioctls originated (ext2 and XFS,
    respectively) and everybody else.

    - Standardize parameter checking for the SETFLAGS and FSSETXATTR
    ioctls (which were the file attribute setters for ext4 and xfs and
    have now been hoisted to the vfs)

    - Only allow the DAX flag to be set on files and directories"

    * tag 'vfs-fix-ioctl-checking-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
    vfs: only allow FSSETXATTR to set DAX flag on files and dirs
    vfs: teach vfs_ioc_fssetxattr_check to check extent size hints
    vfs: teach vfs_ioc_fssetxattr_check to check project id info
    vfs: create a generic checking function for FS_IOC_FSSETXATTR
    vfs: create a generic checking and prep function for FS_IOC_SETFLAGS

    Linus Torvalds
     
  • Pull driver core and debugfs updates from Greg KH:
    "Here is the "big" driver core and debugfs changes for 5.3-rc1

    It's a lot of different patches, all across the tree due to some api
    changes and lots of debugfs cleanups.

    Other than the debugfs cleanups, in this set of changes we have:

    - bus iteration function cleanups

    - scripts/get_abi.pl tool to display and parse Documentation/ABI
    entries in a simple way

    - cleanups to Documenatation/ABI/ entries to make them parse easier
    due to typos and other minor things

    - default_attrs use for some ktype users

    - driver model documentation file conversions to .rst

    - compressed firmware file loading

    - deferred probe fixes

    All of these have been in linux-next for a while, with a bunch of
    merge issues that Stephen has been patient with me for"

    * tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (102 commits)
    debugfs: make error message a bit more verbose
    orangefs: fix build warning from debugfs cleanup patch
    ubifs: fix build warning after debugfs cleanup patch
    driver: core: Allow subsystems to continue deferring probe
    drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT
    arch_topology: Remove error messages on out-of-memory conditions
    lib: notifier-error-inject: no need to check return value of debugfs_create functions
    swiotlb: no need to check return value of debugfs_create functions
    ceph: no need to check return value of debugfs_create functions
    sunrpc: no need to check return value of debugfs_create functions
    ubifs: no need to check return value of debugfs_create functions
    orangefs: no need to check return value of debugfs_create functions
    nfsd: no need to check return value of debugfs_create functions
    lib: 842: no need to check return value of debugfs_create functions
    debugfs: provide pr_fmt() macro
    debugfs: log errors when something goes wrong
    drivers: s390/cio: Fix compilation warning about const qualifiers
    drivers: Add generic helper to match by of_node
    driver_find_device: Unify the match function with class_find_device()
    bus_find_device: Unify the match callback with class_find_device
    ...

    Linus Torvalds
     

11 Jul, 2019

1 commit

  • Pull fscrypt updates from Eric Biggers:

    - Preparations for supporting encryption on ext4 filesystems where the
    filesystem block size is smaller than PAGE_SIZE.

    - Don't allow setting encryption policies on dead directories.

    - Various cleanups.

    * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
    fscrypt: document testing with xfstests
    fscrypt: remove selection of CONFIG_CRYPTO_SHA256
    fscrypt: remove unnecessary includes of ratelimit.h
    fscrypt: don't set policy for a dead directory
    ext4: encrypt only up to last block in ext4_bio_write_page()
    ext4: decrypt only the needed block in __ext4_block_zero_page_range()
    ext4: decrypt only the needed blocks in ext4_block_write_begin()
    ext4: clear BH_Uptodate flag on decryption error
    fscrypt: decrypt only the needed blocks in __fscrypt_decrypt_bio()
    fscrypt: support decrypting multiple filesystem blocks per page
    fscrypt: introduce fscrypt_decrypt_block_inplace()
    fscrypt: handle blocksize < PAGE_SIZE in fscrypt_zeroout_range()
    fscrypt: support encrypting multiple filesystem blocks per page
    fscrypt: introduce fscrypt_encrypt_block_inplace()
    fscrypt: clean up some BUG_ON()s in block encryption/decryption
    fscrypt: rename fscrypt_do_page_crypto() to fscrypt_crypt_block()
    fscrypt: remove the "write" part of struct fscrypt_ctx
    fscrypt: simplify bounce page handling

    Linus Torvalds