Skip to content

loop: Fix NULL pointer dereference by synchronizing lo_release and loop_queue_rq#816

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1092734=>linus-master
Open

loop: Fix NULL pointer dereference by synchronizing lo_release and loop_queue_rq#816
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1092734=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci Bot commented May 11, 2026

Pull request for series with
subject: loop: Fix NULL pointer dereference by synchronizing lo_release and loop_queue_rq
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1092734

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 11, 2026

Upstream branch: aa54b1d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1092734
version: 1

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 15, 2026

Upstream branch: aa54b1d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot added V2 and removed V1 labels May 15, 2026
@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 0496512 to 57c5032 Compare May 15, 2026 01:51
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from b1870f6 to ca57796 Compare May 15, 2026 07:55
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 15, 2026

Upstream branch: 70eda68
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 57c5032 to 2de7efb Compare May 15, 2026 08:05
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ca57796 to c1feb59 Compare May 21, 2026 02:54
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 21, 2026

Upstream branch: 8bc67e4
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 2de7efb to 43bd3eb Compare May 21, 2026 03:02
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c1feb59 to ea833a1 Compare May 22, 2026 01:53
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 22, 2026

Upstream branch: 6779b50
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 43bd3eb to 14d5595 Compare May 22, 2026 02:02
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ea833a1 to 7af85d1 Compare May 23, 2026 06:11
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 23, 2026

Upstream branch: 79bd2dd
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 14d5595 to 0c0ff88 Compare May 23, 2026 07:18
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7af85d1 to de94ac7 Compare May 23, 2026 17:08
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 23, 2026

Upstream branch: eed108e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 0c0ff88 to 0043504 Compare May 23, 2026 17:47
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from de94ac7 to 86d8d37 Compare May 26, 2026 15:38
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 26, 2026

Upstream branch: e8c2f9f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 0043504 to 8ae013b Compare May 26, 2026 16:19
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 86d8d37 to 9805659 Compare May 28, 2026 13:24
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 28, 2026

Upstream branch: eb3f4b7
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 8ae013b to 2236345 Compare May 28, 2026 15:08
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 9805659 to 3f4a345 Compare May 29, 2026 11:12
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 29, 2026

Upstream branch: 8fde5d1
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 2236345 to 63c9db2 Compare May 29, 2026 12:00
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 3f4a345 to c6dc343 Compare June 1, 2026 08:58
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jun 1, 2026

Upstream branch: e43ffb6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 63c9db2 to 802627a Compare June 1, 2026 09:49
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c6dc343 to fc36596 Compare June 3, 2026 13:56
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Jun 3, 2026

Upstream branch: ba3e43a
series: https://patchwork.kernel.org/project/linux-block/list/?series=1095078
version: 2

…op_queue_rq

The loop driver relies on lo_release() to automatically clear the loop
device via __loop_clr_fd() when the last file descriptor is closed
(LO_FLAGS_AUTOCLEAR). Although the backing file structure itself remains
allocated in memory thanks to proper file reference counting (f_count is
not zero), a severe race condition exists regarding the visibility of
the lo->lo_backing_file pointer.

This race window was exposed by commit 65565ca ("block: unify
the synchronous bi_end_io callbacks"). By unifying and optimizing
the synchronous I/O completion path, the timing and scheduling behavior of
the block layer altered significantly.
As a result, a highly-concurrent execution pipeline emerged where
lo_release() can progress to __loop_clr_fd() and nullify
lo->lo_backing_file while an already-scheduled asynchronous I/O work
(lo_rw_aio) is just about to be executed by a kworker thread.

Since the kworker enters lo_rw_aio() after lo->lo_backing_file has been
cleared, it attempts to dereference the now-NULL pointer when initializing
the kiocb, leading to the reported NULL pointer dereference bug.

To close this race safely without introducing heavy fast-path checks,
we must ensure that any running or scheduled dispatch threads have
completed before we nullify the pointer. Since loop_queue_rq() operates
within the block layer's RCU read-side critical section, invoke
synchronize_rcu() and drain_workqueue() in __loop_clr_fd() prior to
clearing lo->lo_backing_file.

Reported-by: syzbot+cd8a9a308e879a4e2c28@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=cd8a9a308e879a4e2c28
Reported-by: syzbot+bc273027d5643e48e5b3@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=bc273027d5643e48e5b3
Analyzed-by: AI Mode in Google Search (no mail address)
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
@blktests-ci blktests-ci Bot force-pushed the series/1092734=>linus-master branch from 802627a to 198ffc2 Compare June 3, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants