Commit adbb0eb
btrfs: check block group before marking it unused in balance_remap_chunks()
Fix a potential segfault in balance_remap_chunks(): if we quit early
because btrfs_inc_block_group_ro() fails, all the remaining items in the
chunks list will still have their bg value set to NULL. It's thus not
safe to dereference this pointer without checking first.
Reported-by: Chris Mason <clm@fb.com>
Link: https://lore.kernel.org/linux-btrfs/20260125120717.1578828-1-clm@meta.com/
Fixes: 81e5a45 ("btrfs: allow balancing remap tree")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 057495c commit adbb0eb
1 file changed
+17
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4277 | 4277 | | |
4278 | 4278 | | |
4279 | 4279 | | |
| 4280 | + | |
4280 | 4281 | | |
4281 | 4282 | | |
4282 | 4283 | | |
4283 | | - | |
4284 | | - | |
4285 | | - | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
4286 | 4294 | | |
4287 | | - | |
4288 | | - | |
| 4295 | + | |
| 4296 | + | |
4289 | 4297 | | |
4290 | | - | |
4291 | | - | |
| 4298 | + | |
| 4299 | + | |
4292 | 4300 | | |
4293 | | - | |
| 4301 | + | |
| 4302 | + | |
4294 | 4303 | | |
4295 | 4304 | | |
4296 | 4305 | | |
| |||
0 commit comments