[tip: x86/urgent] x86/ioperm: Prevent NULL dereference on theoretical missing IO bitmap
From: tip-bot2 for Li RongQing
Date: Mon Jun 15 2026 - 03:47:34 EST
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 2d36d3b451a94899db9c965adde15492ffe6027a
Gitweb: https://git.kernel.org/tip/2d36d3b451a94899db9c965adde15492ffe6027a
Author: Li RongQing <lirongqing@xxxxxxxxx>
AuthorDate: Mon, 15 Jun 2026 15:01:15 +08:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Mon, 15 Jun 2026 09:40:45 +02:00
x86/ioperm: Prevent NULL dereference on theoretical missing IO bitmap
Outside the IOPL emulation path, the IO bitmap is always expected
to be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE()
handles the case where the flag and the pointer got out of sync.
In this theoretical scenario, which presumes some other bug in the
code that triggers the WARN_ON_ONCe(), return early, instead of
continuing and dereferencing a NULL pointer.
[ mingo: Clarified the changelog. ]
Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Reviewed-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
Cc: H. Peter Anvin <hpa@xxxxxxxxx>
Link: https://patch.msgid.link/20260615070115.4720-1-lirongqing@xxxxxxxxx
---
arch/x86/kernel/process.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4c718f8..d5cd217 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -486,6 +486,7 @@ void native_tss_update_io_bitmap(void)
if (WARN_ON_ONCE(!iobm)) {
clear_thread_flag(TIF_IO_BITMAP);
native_tss_invalidate_io_bitmap();
+ return;
}
/*