1. 10 1月, 2019 3 次提交
  2. 21 11月, 2018 17 次提交
  3. 14 11月, 2018 6 次提交
    • T
      ext4: fix use-after-free race in ext4_remount()'s error path · 15f255ec
      Theodore Ts'o 提交于
      commit 33458eaba4dfe778a426df6a19b7aad2ff9f7eec upstream.
      
      It's possible for ext4_show_quota_options() to try reading
      s_qf_names[i] while it is being modified by ext4_remount() --- most
      notably, in ext4_remount's error path when the original values of the
      quota file name gets restored.
      
      Reported-by: syzbot+a2872d6feea6918008a9@syzkaller.appspotmail.com
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org # 3.2+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15f255ec
    • W
      ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR · ce1daaa8
      Wang Shilong 提交于
      commit 182a79e0c17147d2c2d3990a9a7b6b58a1561c7a upstream.
      
      We return most failure of dquota_initialize() except
      inode evict, this could make a bit sense, for example
      we allow file removal even quota files are broken?
      
      But it dosen't make sense to allow setting project
      if quota files etc are broken.
      Signed-off-by: NWang Shilong <wshilong@ddn.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce1daaa8
    • W
      ext4: fix setattr project check in fssetxattr ioctl · 0d0413e9
      Wang Shilong 提交于
      commit dc7ac6c4cae3b58724c2f1e21a7c05ce19ecd5a8 upstream.
      
      Currently, project quota could be changed by fssetxattr
      ioctl, and existed permission check inode_owner_or_capable()
      is obviously not enough, just think that common users could
      change project id of file, that could make users to
      break project quota easily.
      
      This patch try to follow same regular of xfs project
      quota:
      
      "Project Quota ID state is only allowed to change from
      within the init namespace. Enforce that restriction only
      if we are trying to change the quota ID state.
      Everything else is allowed in user namespaces."
      
      Besides that, check and set project id'state should
      be an atomic operation, protect whole operation with
      inode lock, ext4_ioctl_setproject() is only used for
      ioctl EXT4_IOC_FSSETXATTR, we have held mnt_want_write_file()
      before ext4_ioctl_setflags(), and ext4_ioctl_setproject()
      is called after ext4_ioctl_setflags(), we could share
      codes, so remove it inside ext4_ioctl_setproject().
      Signed-off-by: NWang Shilong <wshilong@ddn.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: NAndreas Dilger <adilger@dilger.ca>
      Cc: stable@kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d0413e9
    • L
      ext4: initialize retries variable in ext4_da_write_inline_data_begin() · 99a3b224
      Lukas Czerner 提交于
      commit 625ef8a3acd111d5f496d190baf99d1a815bd03e upstream.
      
      Variable retries is not initialized in ext4_da_write_inline_data_begin()
      which can lead to nondeterministic number of retries in case we hit
      ENOSPC. Initialize retries to zero as we do everywhere else.
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Fixes: bc0ca9df ("ext4: retry allocation when inline->extent conversion failed")
      Cc: stable@kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99a3b224
    • T
      ext4: fix EXT4_IOC_SWAP_BOOT · b2af09dd
      Theodore Ts'o 提交于
      commit 18aded17 upstream.
      
      The code EXT4_IOC_SWAP_BOOT ioctl hasn't been updated in a while, and
      it's a bit broken with respect to more modern ext4 kernels, especially
      metadata checksums.
      
      Other problems fixed with this commit:
      
      * Don't allow installing a DAX, swap file, or an encrypted file as a
        boot loader.
      
      * Respect the immutable and append-only flags.
      
      * Wait until any DIO operations are finished *before* calling
        truncate_inode_pages().
      
      * Don't swap inode->i_flags, since these flags have nothing to do with
        the inode blocks --- and it will give the IMA/audit code heartburn
        when the inode is evicted.
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Reported-by: syzbot+e81ccd4744c6c4f71354@syzkaller.appspotmail.com
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2af09dd
    • T
      ext4: fix argument checking in EXT4_IOC_MOVE_EXT · 3d267c56
      Theodore Ts'o 提交于
      [ Upstream commit f18b2b83a727a3db208308057d2c7945f368e625 ]
      
      If the starting block number of either the source or destination file
      exceeds the EOF, EXT4_IOC_MOVE_EXT should return EINVAL.
      
      Also fixed the helper function mext_check_coverage() so that if the
      logical block is beyond EOF, make it return immediately, instead of
      looping until the block number wraps all the away around.  This takes
      long enough that if there are multiple threads trying to do pound on
      an the same inode doing non-sensical things, it can end up triggering
      the kernel's soft lockup detector.
      
      Reported-by: syzbot+c61979f6f2cba5cb3c06@syzkaller.appspotmail.com
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d267c56
  4. 16 9月, 2018 4 次提交
  5. 12 9月, 2018 1 次提交
  6. 04 9月, 2018 2 次提交
  7. 02 9月, 2018 2 次提交
    • T
      ext4: recalucate superblock checksum after updating free blocks/inodes · 4274f516
      Theodore Ts'o 提交于
      When mounting the superblock, ext4_fill_super() calculates the free
      blocks and free inodes and stores them in the superblock.  It's not
      strictly necessary, since we don't use them any more, but it's nice to
      keep them roughly aligned to reality.
      
      Since it's not critical for file system correctness, the code doesn't
      call ext4_commit_super().  The problem is that it's in
      ext4_commit_super() that we recalculate the superblock checksum.  So
      if we're not going to call ext4_commit_super(), we need to call
      ext4_superblock_csum_set() to make sure the superblock checksum is
      consistent.
      
      Most of the time, this doesn't matter, since we end up calling
      ext4_commit_super() very soon thereafter, and definitely by the time
      the file system is unmounted.  However, it doesn't work in this
      sequence:
      
      mke2fs -Fq -t ext4 /dev/vdc 128M
      mount /dev/vdc /vdc
      cp xfstests/git-versions /vdc
      godown /vdc
      umount /vdc
      mount /dev/vdc
      tune2fs -l /dev/vdc
      
      With this commit, the "tune2fs -l" no longer fails.
      Reported-by: NChengguang Xu <cgxu519@gmx.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Cc: stable@vger.kernel.org
      
      
      4274f516
    • T
      ext4: avoid arithemetic overflow that can trigger a BUG · bcd8e91f
      Theodore Ts'o 提交于
      A maliciously crafted file system can cause an overflow when the
      results of a 64-bit calculation is stored into a 32-bit length
      parameter.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=200623Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Reported-by: NWen Xu <wen.xu@gatech.edu>
      Cc: stable@vger.kernel.org
      bcd8e91f
  8. 27 8月, 2018 3 次提交
  9. 18 8月, 2018 2 次提交