Skip to content

btrfs: fix use-after-free in btrfs_encoded_read_endio

Johannes Thumshirn linux-btrfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 4 repliesIn review
  2. v22 patches 6 repliesSuperseded
  3. v12 patches 7 repliesSuperseded

Changes to v2 from the cover letter

- Make patch 1/2 only do the atomic_dec_and_test() as a minimal viable fix
- Make patch 2/2 only do completion and refcount_t

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: fix use-after-free in btrfs_encoded_read_endiofs/btrfs/inode.c+1 -12 replies
2/2btrfs: simplify waiting for encoded read endiosfs/btrfs/inode.c+12 -112 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchFilipe MananaQu Wenruo
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] btrfs: fix use-after-free in btrfs_encoded_read_endio

Shinichiro reported a occassional memory corruption in our CI system with btrfs/248 that lead to panics. He also managed to reproduce this corruption reliably on one host. See patch 1/2 for details on the corruption and the fix, patch 2/2 is a cleanup Damien suggested on top of the fix to make the code more obvious.

Changes to v2:
- Make patch 1/2 only do the atomic_dec_and_test() as a minimal viable fix
- Make patch 2/2 only do completion and refcount_t

Link to v2:
https://lore.kernel.org/linux-btrfs/[email protected]

Changes to v1:
- Update commit message of patch 1/1
- Prevent double-free of 'priv' in case of io_uring in 2/2
- Use wait_for_completion_io() in 2/2
- Convert priv->pending from atomic_t to refcount_t calling it refs in 2/2

Link to v1:
https://lore.kernel.org/linux-btrfs/[email protected]

Johannes Thumshirn (2):
btrfs: fix use-after-free in btrfs_encoded_read_endio
btrfs: simplify waiting for encoded read endios

 fs/btrfs/inode.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0