]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/ioperm: Prevent NULL dereference on theoretical missing IO bitmap
authorLi RongQing <lirongqing@baidu.com>
Mon, 15 Jun 2026 07:01:15 +0000 (15:01 +0800)
committerIngo Molnar <mingo@kernel.org>
Mon, 15 Jun 2026 07:40:45 +0000 (09:40 +0200)
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@baidu.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: https://patch.msgid.link/20260615070115.4720-1-lirongqing@baidu.com
arch/x86/kernel/process.c

index 4c718f8adc592d5f9db023ecc3f4307cdb726dfe..d5cd2177f18a5428554a0fd55745a0292900174f 100644 (file)
@@ -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;
                }
 
                /*