1. 29 5月, 2023 1 次提交
    • T
      ext4: add EA_INODE checking to ext4_iget() · b3e6bcb9
      Theodore Ts'o 提交于
      Add a new flag, EXT4_IGET_EA_INODE which indicates whether the inode
      is expected to have the EA_INODE flag or not.  If the flag is not
      set/clear as expected, then fail the iget() operation and mark the
      file system as corrupted.
      
      This commit also makes the ext4_iget() always perform the
      is_bad_inode() check even when the inode is already inode cache.  This
      allows us to remove the is_bad_inode() check from the callers of
      ext4_iget() in the ea_inode code.
      
      Reported-by: syzbot+cbb68193bdb95af4340a@syzkaller.appspotmail.com
      Reported-by: syzbot+62120febbd1ee3c3c860@syzkaller.appspotmail.com
      Reported-by: syzbot+edce54daffee36421b4c@syzkaller.appspotmail.com
      Cc: stable@kernel.org
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20230524034951.779531-2-tytso@mit.eduSigned-off-by: NTheodore Ts'o <tytso@mit.edu>
      b3e6bcb9
  2. 14 5月, 2023 2 次提交
  3. 28 4月, 2023 1 次提交
    • Z
      ext4: fix i_disksize exceeding i_size problem in paritally written case · 1dedde69
      Zhihao Cheng 提交于
      It is possible for i_disksize can exceed i_size, triggering a warning.
      
      generic_perform_write
       copied = iov_iter_copy_from_user_atomic(len) // copied < len
       ext4_da_write_end
       | ext4_update_i_disksize
       |  new_i_size = pos + copied;
       |  WRITE_ONCE(EXT4_I(inode)->i_disksize, newsize) // update i_disksize
       | generic_write_end
       |  copied = block_write_end(copied, len) // copied = 0
       |   if (unlikely(copied < len))
       |    if (!PageUptodate(page))
       |     copied = 0;
       |  if (pos + copied > inode->i_size) // return false
       if (unlikely(copied == 0))
        goto again;
       if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
        status = -EFAULT;
        break;
       }
      
      We get i_disksize greater than i_size here, which could trigger WARNING
      check 'i_size_read(inode) < EXT4_I(inode)->i_disksize' while doing dio:
      
      ext4_dio_write_iter
       iomap_dio_rw
        __iomap_dio_rw // return err, length is not aligned to 512
       ext4_handle_inode_extension
        WARN_ON_ONCE(i_size_read(inode) < EXT4_I(inode)->i_disksize) // Oops
      
       WARNING: CPU: 2 PID: 2609 at fs/ext4/file.c:319
       CPU: 2 PID: 2609 Comm: aa Not tainted 6.3.0-rc2
       RIP: 0010:ext4_file_write_iter+0xbc7
       Call Trace:
        vfs_write+0x3b1
        ksys_write+0x77
        do_syscall_64+0x39
      
      Fix it by updating 'copied' value before updating i_disksize just like
      ext4_write_inline_data_end() does.
      
      A reproducer can be found in the buganizer link below.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217209
      Fixes: 64769240 ("ext4: Add delayed allocation support in data=writeback mode")
      Signed-off-by: NZhihao Cheng <chengzhihao1@huawei.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20230321013721.89818-1-chengzhihao1@huawei.comSigned-off-by: NTheodore Ts'o <tytso@mit.edu>
      1dedde69
  4. 15 4月, 2023 8 次提交
  5. 07 4月, 2023 15 次提交
  6. 06 4月, 2023 1 次提交
  7. 24 3月, 2023 2 次提交
  8. 23 3月, 2023 7 次提交
  9. 11 3月, 2023 1 次提交
  10. 19 2月, 2023 2 次提交