]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kernel/fork: clear PF_BLOCK_TS in copy_process()
authorUsama Arif <usama.arif@linux.dev>
Tue, 16 Jun 2026 14:15:17 +0000 (07:15 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 16 Jun 2026 16:07:36 +0000 (10:07 -0600)
PF_BLOCK_TS is only set in blk_time_get_ns() when current->plug is
non-NULL, and blk_finish_plug() clears it via __blk_flush_plug()
before NULLing the plug pointer.  copy_process() breaks the
invariant by inheriting PF_BLOCK_TS from the parent while resetting
the child's plug to NULL.

Clear PF_BLOCK_TS alongside that assignment so callers can rely on
"PF_BLOCK_TS set implies current->plug != NULL" and dereference
current->plug unguarded.

Fixes: 06b23f92af87 ("block: update cached timestamp post schedule/preemption")
Cc: stable@vger.kernel.org
Signed-off-by: Usama Arif <usama.arif@linux.dev>
Link: https://patch.msgid.link/20260616141604.328820-2-usama.arif@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/fork.c

index addc555a107707c097e813d4eb8480f140c26c52..1fafcb9bb0473a1741f18e23685148c511241f86 100644 (file)
@@ -2337,6 +2337,7 @@ __latent_entropy struct task_struct *copy_process(
 
 #ifdef CONFIG_BLOCK
        p->plug = NULL;
+       p->flags &= ~PF_BLOCK_TS;
 #endif
        futex_init_task(p);