btrfs: fix logical_to_ino panic in btrfs_map_bio
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 3 repliesIn review
- v32 patches 0 repliesSuperseded
- v22 patches 4 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 2 patches | 3 replies | Superseded |
Changes in v4 from the cover letter
- actually include the changes to Patch 1 cited in v3, my mistake. v3:
- fix bug from missing RB_CLEAR_NODE
- assert on move nr_items = 0 and max_slot < -1
- document max_slot with a comment
- change to ints for max_slot
- get rid of now redundant warning. max_slot=-1, move_dst_end=-1 is "OK" though it will assert.
- re-add max_slot setting after move that got lost in v2...
- remove unrelated formatting changes
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs: warn on invalid slot in tree mod log rewindfs/ | +41 | 1 reply | |
| 2/2 | btrfs: insert tree mod log move in push_node_leftfs/ fs/ | +71 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Filipe Manana |
|---|---|
| 1/2 | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/2] btrfs: fix logical_to_ino panic in btrfs_map_bio
The gory details are in the second patch, but it is possible to panic the kernel by running the ioctl BTRFS_IOC_LOGICAL_INO (and V2 of that ioctl).
The TL;DR of the problem is that we do not properly handle logging a move from a push_node_left btree balancing operation in the tree mod log, so it is possible for backref walking using the tree mod log to construct an invalid extent_buffer and ultimately try to map invalid bios for block 0 which ultimately hits a null pointer error and panics.
The patch set introduces additional bookkeeping in tree mod log to warn on this issue and also fixes the issue itself.
---
Changelog:
v4:
- actually include the changes to Patch 1 cited in v3, my mistake. v3:
- fix bug from missing RB_CLEAR_NODE
- assert on move nr_items = 0 and max_slot < -1
- document max_slot with a comment
- change to ints for max_slot
- get rid of now redundant warning. max_slot=-1, move_dst_end=-1 is "OK" though it will assert.
- re-add max_slot setting after move that got lost in v2...
- remove unrelated formatting changes
v2:
- move WARN to before the bad memmove
- change WARN to WARN_ON + btrfs_warn
- fix tm freeing bug in tree_mod_log_insert_move
- unify error handling for tm alloc failures on setting tm=NULL after setting ret=PTR_ERR(tm) and then calling kfree unconditionally
- tidying/nits
Boris Burkov (2):
btrfs: warn on invalid slot in tree mod log rewind
btrfs: insert tree mod log move in push_node_left
fs/btrfs/ctree.c | 11 ++-- fs/btrfs/tree-mod-log.c | 114 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 112 insertions(+), 13 deletions(-)
Signature · 1 line
2.40.1