RE: [PATCH v2] ACPI: APEI: do not add task_work to kernel thread to avoid memory leak

From: Luck, Tony
Date: Mon Sep 26 2022 - 12:33:51 EST


>>
>> - if (task_work_pending && current->mm != &init_mm) {
>> + if (task_work_pending && current->mm) {
>> estatus_node->task_work.func = ghes_kick_task_work;
>> estatus_node->task_work_cpu = smp_processor_id();
>> ret = task_work_add(current, &estatus_node->task_work,

It seems that you are getting errors reported while running kernel threads. This fix avoids
pointlessly adding "task_work" that will never be processed because kernel threads never
return to user mode.

But maybe something else needs to be done? The code was, and with this fix still is,
taking no action for the error. That doesn't seem right.

Are you injecting errors to create this scenario? What does your test do?

-Tony