aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/task_work.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-21 08:42:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-21 08:42:22 +0200
commitd723c456ef5ad60d368e62791004fd152c4380aa (patch)
treee517740ce6685407ead9cf300c93fd6c2b5df451 /kernel/task_work.c
parentMerge tag 'iio-for-6.13a-take2' of ssh://gitolite.kernel.org/pub/scm/linux/ke... (diff)
parentLinux 6.12-rc4 (diff)
downloadlinux-d723c456ef5ad60d368e62791004fd152c4380aa.tar.gz
linux-d723c456ef5ad60d368e62791004fd152c4380aa.zip
Merge 6.12-rc4 into char-misc-next
We need the iio fixes from 6.12-rc4 in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/task_work.c')
-rw-r--r--kernel/task_work.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/task_work.c b/kernel/task_work.c
index 5d14d639ac71..c969f1f26be5 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -55,15 +55,26 @@ int task_work_add(struct task_struct *task, struct callback_head *work,
enum task_work_notify_mode notify)
{
struct callback_head *head;
+ int flags = notify & TWA_FLAGS;
+ notify &= ~TWA_FLAGS;
if (notify == TWA_NMI_CURRENT) {
if (WARN_ON_ONCE(task != current))
return -EINVAL;
if (!IS_ENABLED(CONFIG_IRQ_WORK))
return -EINVAL;
} else {
- /* record the work call stack in order to print it in KASAN reports */
- kasan_record_aux_stack(work);
+ /*
+ * Record the work call stack in order to print it in KASAN
+ * reports.
+ *
+ * Note that stack allocation can fail if TWAF_NO_ALLOC flag
+ * is set and new page is needed to expand the stack buffer.
+ */
+ if (flags & TWAF_NO_ALLOC)
+ kasan_record_aux_stack_noalloc(work);
+ else
+ kasan_record_aux_stack(work);
}
head = READ_ONCE(task->task_works);