Commit 46ef85f
md/bitmap: fix GPF in write_page caused by resize race
A General Protection Fault occurs in write_page() during array resize:
RIP: 0010:write_page+0x22b/0x3c0 [md_mod]
This is a use-after-free race between bitmap_daemon_work() and
__bitmap_resize(). The daemon iterates over `bitmap->storage.filemap`
without locking, while the resize path frees that storage via
md_bitmap_file_unmap(). `quiesce()` does not stop the md thread,
allowing concurrent access to freed pages.
Fix by holding `mddev->bitmap_info.mutex` during the bitmap update.
Link: https://lore.kernel.org/linux-raid/[email protected]
Closes: https://lore.kernel.org/linux-raid/CAMGffE=Mbfp=7xD_hYxXk1PAaCZNSEAVeQGKGy7YF9f2S4=NEA@mail.gmail.com/T/#u
Cc: [email protected]
Fixes: d60b479 ("md/bitmap: add bitmap_resize function to allow bitmap resizing.")
Signed-off-by: Jack Wang <[email protected]>
Signed-off-by: Yu Kuai <[email protected]>1 parent d119bd2 commit 46ef85f
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2453 | 2453 | | |
2454 | 2454 | | |
2455 | 2455 | | |
| 2456 | + | |
2456 | 2457 | | |
2457 | 2458 | | |
2458 | 2459 | | |
| |||
2560 | 2561 | | |
2561 | 2562 | | |
2562 | 2563 | | |
2563 | | - | |
| 2564 | + | |
2564 | 2565 | | |
2565 | 2566 | | |
2566 | 2567 | | |
| |||
0 commit comments