* [PATCH] smpboot: Add NULL check before kthread_unpark()
@ 2025-11-24 5:11 Kaushlendra Kumar
2025-12-10 6:50 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Kaushlendra Kumar @ 2025-11-24 5:11 UTC (permalink / raw)
To: tglx, peterz; +Cc: linux-kernel, Kaushlendra Kumar
Add NULL check for tsk before calling kthread_unpark() in
smpboot_unpark_thread() to prevent potential null pointer
dereference.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
kernel/smpboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 4503b60ce9bd..a37d25b23f58 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -225,7 +225,7 @@ static void smpboot_unpark_thread(struct smp_hotplug_thread *ht, unsigned int cp
{
struct task_struct *tsk = *per_cpu_ptr(ht->store, cpu);
- if (!ht->selfparking)
+ if (tsk && !ht->selfparking)
kthread_unpark(tsk);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] smpboot: Add NULL check before kthread_unpark()
2025-11-24 5:11 [PATCH] smpboot: Add NULL check before kthread_unpark() Kaushlendra Kumar
@ 2025-12-10 6:50 ` Thomas Gleixner
2025-12-10 8:21 ` Kumar, Kaushlendra
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2025-12-10 6:50 UTC (permalink / raw)
To: Kaushlendra Kumar, peterz; +Cc: linux-kernel
On Mon, Nov 24 2025 at 10:41, Kaushlendra Kumar wrote:
> Add NULL check for tsk before calling kthread_unpark() in
> smpboot_unpark_thread() to prevent potential null pointer
> dereference.
How is that ever going to be NULL?
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] smpboot: Add NULL check before kthread_unpark()
2025-12-10 6:50 ` Thomas Gleixner
@ 2025-12-10 8:21 ` Kumar, Kaushlendra
2025-12-12 1:10 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Kumar, Kaushlendra @ 2025-12-10 8:21 UTC (permalink / raw)
To: Thomas Gleixner, peterz@infradead.org; +Cc: linux-kernel@vger.kernel.org
On Mon, Nov 24 2025, Thomas Gleixner wrote:
> On Mon, Nov 24 2025 at 10:41, Kaushlendra Kumar wrote:
>> Add NULL check for tsk before calling kthread_unpark() in
>> smpboot_unpark_thread() to prevent potential null pointer dereference.
>
> How is that ever going to be NULL?
Thanks for the review.
Here I was only concerned about edge cases during CPU hotplug state transitions.
Could you help clarify: are there any scenarios during the CPU hotplug state
transition where this function might be called without a valid task, or is the
current flow guaranteed to always have tsk initialized at this point?
If the existing code ensure tsk is always valid here, will drop this patch.
-Kaushlendra
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] smpboot: Add NULL check before kthread_unpark()
2025-12-10 8:21 ` Kumar, Kaushlendra
@ 2025-12-12 1:10 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2025-12-12 1:10 UTC (permalink / raw)
To: Kumar, Kaushlendra, peterz@infradead.org; +Cc: linux-kernel@vger.kernel.org
On Wed, Dec 10 2025 at 08:21, Kaushlendra Kumar wrote:
> On Mon, Nov 24 2025, Thomas Gleixner wrote:
>> On Mon, Nov 24 2025 at 10:41, Kaushlendra Kumar wrote:
>>> Add NULL check for tsk before calling kthread_unpark() in
>>> smpboot_unpark_thread() to prevent potential null pointer dereference.
>>
>> How is that ever going to be NULL?
> Thanks for the review.
> Here I was only concerned about edge cases during CPU hotplug state transitions.
Then describe your concern and the edge cases in detail.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-12 1:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24 5:11 [PATCH] smpboot: Add NULL check before kthread_unpark() Kaushlendra Kumar
2025-12-10 6:50 ` Thomas Gleixner
2025-12-10 8:21 ` Kumar, Kaushlendra
2025-12-12 1:10 ` Thomas Gleixner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.