1. 08 9月, 2020 1 次提交
  2. 24 8月, 2020 1 次提交
  3. 03 8月, 2020 3 次提交
  4. 17 7月, 2020 1 次提交
  5. 03 6月, 2020 1 次提交
    • C
      mm: remove the pgprot argument to __vmalloc · 88dca4ca
      Christoph Hellwig 提交于
      The pgprot argument to __vmalloc is always PAGE_KERNEL now, so remove it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: Michael Kelley <mikelley@microsoft.com> [hyperv]
      Acked-by: Gao Xiang <xiang@kernel.org> [erofs]
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWei Liu <wei.liu@kernel.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-22-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      88dca4ca
  6. 18 5月, 2020 1 次提交
  7. 08 5月, 2020 1 次提交
  8. 10 4月, 2020 1 次提交
    • C
      ubifs: remove broken lazytime support · ecf84096
      Christoph Hellwig 提交于
      When "ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs" introduced atime
      support to ubifs, it also added lazytime support.  As far as I can tell
      the lazytime support is terminally broken, as it causes
      mark_inode_dirty_sync to be called from __writeback_single_inode, which
      will then trigger the locking assert in ubifs_dirty_inode.  Just remove
      the broken lazytime support for now, it can be added back later,
      especially as some infrastructure changes should make that easier soon.
      
      Fixes: 8c1c5f26 ("ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs")
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      ecf84096
  9. 31 3月, 2020 4 次提交
  10. 20 3月, 2020 1 次提交
  11. 23 1月, 2020 2 次提交
  12. 21 1月, 2020 1 次提交
  13. 20 1月, 2020 1 次提交
    • Q
      ubifs: Fix memory leak from c->sup_node · ff90bdfb
      Quanyang Wang 提交于
      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:
          [<d1c503cd>] ubifs_read_superblock+0x48/0xebc
          [<a20e14bd>] ubifs_mount+0x974/0x1420
          [<8589ecc3>] legacy_get_tree+0x2c/0x50
          [<5f1fb889>] vfs_get_tree+0x28/0xfc
          [<bbfc7939>] do_mount+0x4f8/0x748
          [<4151f538>] ksys_mount+0x78/0xa0
          [<d59910a9>] ret_fast_syscall+0x0/0x54
          [<1cc40005>] 0x7ea02790
      
      Free it in ubifs_umount and in the error path of mount_ubifs.
      
      Fixes: fd615005 ("ubifs: Store read superblock node")
      Signed-off-by: NQuanyang Wang <quanyang.wang@windriver.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      ff90bdfb
  14. 17 1月, 2020 5 次提交
    • G
      ubifs: Fix ino_t format warnings in orphan_delete() · 155fc6ba
      Geert Uytterhoeven 提交于
      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: 8009ce95 ("ubifs: Don't leak orphans on memory during commit")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      155fc6ba
    • Z
      ubifs: Fix deadlock in concurrent bulk-read and writepage · f5de5b83
      Zhihao Cheng 提交于
      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)                   <--     ABBA deadlock occurs!
      
      In order to ensure the serialization execution of bulk read, we can't
      remove the big lock 'ui->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: NZhihao Cheng <chengzhihao1@huawei.com>
      Suggested-by: Nzhangyi (F) <yi.zhang@huawei.com>
      Cc: <Stable@vger.kernel.org>
      Fixes: 4793e7c5 ("UBIFS: add bulk-read facility")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=206153Signed-off-by: NRichard Weinberger <richard@nod.at>
      f5de5b83
    • S
      ubifs: Fix wrong memory allocation · edec5137
      Sascha Hauer 提交于
      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: c4de6d7e ("ubifs: Refactor create_default_filesystem()")
      Cc: stable@vger.kernel.org # v4.20+
      Reported-by: NNaga Sureshkumar Relli <nagasure@xilinx.com>
      Tested-by: NNaga Sureshkumar Relli <nagasure@xilinx.com>
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      edec5137
    • E
      ubifs: Add support for FS_ENCRYPT_FL · 219b0e2c
      Eric Biggers 提交于
      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: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      219b0e2c
    • E
      ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag · 2b57067a
      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: d475a507 ("ubifs: Add skeleton for fscrypto")
      Cc: <stable@vger.kernel.org> # v4.10+
      Signed-off-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      2b57067a
  15. 01 1月, 2020 2 次提交
  16. 09 12月, 2019 2 次提交
  17. 18 11月, 2019 7 次提交
    • Z
      ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps · 6abf5726
      Zhihao Cheng 提交于
      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 <48> 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: NZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      6abf5726
    • Z
      ubifs: do_kill_orphans: Fix a memory leak bug · 10256f00
      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: ee1438ce ("ubifs: Check link count of inodes when...")
      Signed-off-by: NZhihao Cheng <chengzhihao1@huawei.com>
      Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      10256f00
    • R
      Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path" · 91cbf011
      Richard Weinberger 提交于
      This reverts commit 9163e018.
      
      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 <wenwen@cs.uga.edu>
      Fixes: 9163e018 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")
      Reported-by: https://twitter.com/grsecurity/status/1180609139359277056Signed-off-by: NRichard Weinberger <richard@nod.at>
      Tested-by: NRomain Izard <romain.izard.pro@gmail.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      91cbf011
    • B
      ubifs: Fix type of sup->hash_algo · 7cc7720f
      Ben Dooks (Codethink) 提交于
      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: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      7cc7720f
    • B
      ubifs: Fixed missed le64_to_cpu() in journal · df22b5b3
      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: 7959cf3a ("ubifs: journal: Handle xattrs like files")
      Signed-off-by: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      df22b5b3
    • B
      ubifs: Force prandom result to __le32 · 3cfa4412
      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: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      3cfa4412
    • R
      ubifs: Remove obsolete TODO from dfs_file_write() · b27b281f
      Richard Weinberger 提交于
      AFAICT this kind of problems are no longer possible since
      debugfs gained file removal protection via
      e9117a5a ("debugfs: implement per-file removal protection").
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Nicolai Stange <nicstange@gmail.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      b27b281f
  18. 16 9月, 2019 4 次提交
  19. 30 8月, 2019 1 次提交
    • D
      timestamp_truncate: Replace users of timespec64_trunc · 3818c190
      Deepa Dinamani 提交于
      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: NDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NJeff Layton <jlayton@kernel.org>
      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
      3818c190