x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
PATCH v2 1/1 x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned
From: Li RongQing <[email protected]>
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 rare scenario, return early instead of continuing and dereferencing a NULL pointer.
[Sohil Mehta: rephrased commit message]
---
Diff with v1: rephrased commit message
arch/x86/kernel/process.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/process.c +1 -0
@@ -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 ; }/*
Signature · 1 line
2.9.4
Quoted 10 lines · lirongqing
From: Li RongQing <[email protected]>
Outside the IOPL emulation path, the IO bitmap is always expected to be allocated when
TIF_IO_BITMAPis set. The paranoidWARN_ON_ONCE()handles the case where the flag and the pointer got out of sync. In this rare scenario, return early instead of continuing and dereferencing a NULL pointer.[Sohil Mehta: rephrased commit message]
Never add handler comments for others. Such comments are only expected to be added when someone who is handling your patch modifies it but keeps the original authorship. You shouldn't add handler comments when you are changing the patch as an author yourself.
Quoted 3 lines
Reviewed-by Sohil Mehta <[email protected]>Signed-off-by Li RongQing <[email protected]>---
Quoted 9 lines · lirongqing
Quoted 8 lines
From: Li RongQing <[email protected]>
Outside the IOPL emulation path, the IO bitmap is always expected to be allocated when
TIF_IO_BITMAPis set. The paranoidWARN_ON_ONCE()handles the case where the flag and the pointer got out of sync. In this rare scenario, return early instead of continuing and dereferencing a NULL pointer.
Quoted 8 lines
Quoted 2 lines
[Sohil Mehta: rephrased commit message]
Never add handler comments for others. Such comments are only expected to be added when someone who is handling your patch modifies it but keeps the original authorship. You shouldn't add handler comments when you are changing the patch as an author yourself.
Ok, I will remove it in next version
[Li,Rongqing]
Upon rereading, the title seems very long. Maybe shorten it to:
x86/ioperm: Prevent NULL dereference on missing IO bitmap
Quoted 2 lines · Li,Rongqing
Quoted 2 lines
Quoted 2 lines
[Sohil Mehta: rephrased commit message]
Such comments are usually added below the '---' line if needed.
Quoted 5 lines
Ok, I will remove it in next version
[Li,Rongqing]