Repository navigation
Conversation
|
Upstream branch: d5b6dc3 |
ec9266e to
2e69118
Compare
|
Upstream branch: 24a19b9 |
5050dfb to
df573ff
Compare
2e69118 to
3cdd51f
Compare
|
Upstream branch: 4056b3c |
df573ff to
4b59038
Compare
3cdd51f to
e6ca2c1
Compare
|
Upstream branch: 0fcb05b |
4b59038 to
dcea0fc
Compare
e6ca2c1 to
3d027d5
Compare
|
Upstream branch: 58161ea |
dcea0fc to
fbad3c6
Compare
3d027d5 to
90ea7e4
Compare
|
Upstream branch: c03c1a1 |
fbad3c6 to
4953d43
Compare
90ea7e4 to
435b194
Compare
|
Upstream branch: 7be4bc5 |
4953d43 to
94847b1
Compare
435b194 to
fd67522
Compare
|
Upstream branch: 17bb0e2 |
94847b1 to
e01ff43
Compare
fd67522 to
3b53a63
Compare
|
Upstream branch: 21a7f44 |
e01ff43 to
d0d71bb
Compare
3b53a63 to
5d84576
Compare
|
Upstream branch: 6b4b543 |
d0d71bb to
a960d43
Compare
5d84576 to
6582ed2
Compare
|
Upstream branch: fb2c3f4 |
a960d43 to
1a6e10f
Compare
6582ed2 to
b3a1abc
Compare
|
Upstream branch: d135ab4 |
1a6e10f to
168738d
Compare
b3a1abc to
712496f
Compare
|
Upstream branch: c339f40 |
168738d to
410ba27
Compare
712496f to
a186880
Compare
|
Upstream branch: d89e1d1 |
410ba27 to
6d4fcd0
Compare
a186880 to
46206a3
Compare
|
Upstream branch: 6628e7d |
6d4fcd0 to
3a83b47
Compare
46206a3 to
220bd96
Compare
|
Upstream branch: 05441d6 |
3a83b47 to
f2f1e9a
Compare
220bd96 to
6c4625e
Compare
|
Upstream branch: f66469d |
f2f1e9a to
5d8eabe
Compare
6c4625e to
c7f678d
Compare
|
Upstream branch: d487237 |
5d8eabe to
baefac2
Compare
c7f678d to
6aa6cd1
Compare
syzbot is reporting a NULL pointer dereference [1] and invalid reading of destroyed "struct file" [2] in lo_rw_aio() within the loop driver. Also, syzbot-ci is reporting read attempt on a no-longer bound loop device [3]. These reports are caused by current implementation that a block device's backing storage and associated structures (such as "struct file") are invalidated before all outstanding asynchronous or file-system-driven I/O requests have fully completed. Investigation revealed that filesystems can leak outstanding non-blocking Read/Write requests during error-rollbacks in the mount failure path or during standard unmount sequences: 1. Write Leaks via -EIO: When filemap_fdatawrite_range() returns an error (such as -EIO due to filesystem errors), filemap_write_and_wait_range() skips the subsequent __filemap_fdatawait_range() call. As a result, sync_blockdev() returns prematurely without waiting for the completion of write requests already sitting in flight. 2. Read Leaks via Readahead: Asynchronous metadata readahead requests are entirely ignored by sync_blockdev(), allowing ongoing Read I/O to bypass data synchronization entirely. When these leaked requests later complete or attempt backend processing via loop's kworker (loop_handle_cmd()), they dereference now-invalid or nullified fields. While earlier attempts tried to address this regression inside the loop driver by temporarily releasing disk->open_mutex [4] or proposing a core layer post_release() callback [5], these approaches were rejected because they either introduced invasive driver-specific hooks into the block layer or broke the core mutual exclusion semantics that the block layer relies upon. To fix this comprehensively without introducing deadlocks or altering driver-specific semantics, enforce an explicit queue freeze in the core VFS close path inside bdev_release(), right before disk->open_mutex is acquired: 1. Lock-Free Congestion Clearing: Calling blk_mq_freeze_queue() before acquiring disk->open_mutex avoids any circular locking dependencies (disk->open_mutex => wq_completion => VFS locks => disk->open_mutex), guaranteeing that the lockdep hierarchy remains perfectly undisturbed. 2. Guaranteed Quenching: Freezing the queue ensures that all outstanding asynchronous Direct I/O (cmd->use_aio != 0) and page-cache readahead requests are physically completed and drained before the loop device proceeds to teardown and unbind the backing file via fput(). This architecture-compliant fix should be able to ensure data integrity and lifecycle synchronization across all virtual block devices without muddying block layer locks. Reported-by: syzbot+cd8a9a308e879a4e2c28@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=cd8a9a308e879a4e2c28 [1] Reported-by: syzbot+bc273027d5643e48e5b3@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=bc273027d5643e48e5b3 [2] Link: https://lkml.kernel.org/r/6acbe268.8cdf6287.1eb53.00ed.GAE@google.com [3] Link: https://lkml.kernel.org/r/8dedfc40-9cae-44ff-9960-e0eb1825e963@I-love.SAKURA.ne.jp [4] Link: https://lkml.kernel.org/r/69960302-1535-441a-be4e-d652766d65c2@I-love.SAKURA.ne.jp [5] Assisted-by: Gemini-Pro Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
|
Upstream branch: b3dfbde |
baefac2 to
6eedc2b
Compare
Pull request for series with
subject: block: Wait for inflight requests in bdev_release()
version: 1
url: https://patchwork.kernel.org/series/1183724/