[PATCH] x86/process: Return early on NULL iobm in native_tss_update_io_bitmap()

lirongqing posted 1 patch 1 week ago
arch/x86/kernel/process.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] x86/process: Return early on NULL iobm in native_tss_update_io_bitmap()
Posted by lirongqing 1 week ago
From: Li RongQing <lirongqing@baidu.com>

When 'iobm' is NULL, native_tss_update_io_bitmap() clears the thread
flag and invalidates the TSS bitmap, but falls through to subsequent code
that dereferences 'iobm'.

Add a missing return statement to prevent a potential kernel NULL
pointer dereference panic.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 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;
 		}
 
 		/*
-- 
2.9.4