Skip to content
Snippets Groups Projects
Select Git revision
  • cf6b7789f597fe195e299f9e2ce151bc403ae11e
  • openEuler-1.0-LTS default protected
  • openEuler-22.09
  • OLK-5.10
  • openEuler-22.03-LTS
  • openEuler-22.03-LTS-Ascend
  • master
  • openEuler-22.03-LTS-LoongArch-NW
  • openEuler-22.09-HCK
  • openEuler-20.03-LTS-SP3
  • openEuler-21.09
  • openEuler-21.03
  • openEuler-20.09
  • 4.19.90-2210.5.0
  • 5.10.0-123.0.0
  • 5.10.0-60.63.0
  • 5.10.0-60.62.0
  • 4.19.90-2210.4.0
  • 5.10.0-121.0.0
  • 5.10.0-60.61.0
  • 4.19.90-2210.3.0
  • 5.10.0-60.60.0
  • 5.10.0-120.0.0
  • 5.10.0-60.59.0
  • 5.10.0-119.0.0
  • 4.19.90-2210.2.0
  • 4.19.90-2210.1.0
  • 5.10.0-118.0.0
  • 5.10.0-106.19.0
  • 5.10.0-60.58.0
  • 4.19.90-2209.6.0
  • 5.10.0-106.18.0
  • 5.10.0-106.17.0
33 results

22b970264

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Jan Kara authored and Yongqiang Liu committed
    hulk inclusion
    category: bugfix
    bugzilla: 186975, https://gitee.com/openeuler/kernel/issues/I5HT6F
    CVE: NA
    
    Reference: https://patchwork.ozlabs.org/project/linux-ext4/list/?series=309169
    
    
    
    --------------------------------
    
    When ext4_xattr_block_set() decides to remove xattr block the following
    race can happen:
    
    CPU1                                    CPU2
    ext4_xattr_block_set()                  ext4_xattr_release_block()
      new_bh = ext4_xattr_block_cache_find()
    
                                              lock_buffer(bh);
                                              ref = le32_to_cpu(BHDR(bh)->h_refcount);
                                              if (ref == 1) {
                                                ...
                                                mb_cache_entry_delete();
                                                unlock_buffer(bh);
                                                ext4_free_blocks();
                                                  ...
                                                  ext4_forget(..., bh, ...);
                                                    jbd2_journal_revoke(..., bh);
    
      ext4_journal_get_write_access(..., new_bh, ...)
        do_get_write_access()
          jbd2_journal_cancel_revoke(..., new_bh);
    
    Later the code in ext4_xattr_block_set() finds out the block got freed
    and cancels reusal of the block but the revoke stays canceled and so in
    case of block reuse and journal replay the filesystem can get corrupted.
    If the race works out slightly differently, we can also hit assertions
    in the jbd2 code.
    
    Fix the problem by making sure that once matching mbcache entry is
    found, code dropping the last xattr block reference (or trying to modify
    xattr block in place) waits until the mbcache entry reference is
    dropped. This way code trying to reuse xattr block is protected from
    someone trying to drop the last reference to xattr block.
    
    Reported-and-tested-by: default avatarRitesh Harjani <ritesh.list@gmail.com>
    CC: stable@vger.kernel.org
    Fixes: 82939d79 ("ext4: convert to mbcache2")
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
    Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
    Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
    cf6b7789
    History
    Name Last commit Last update