diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-10-25 15:24:08 +0200 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-10-25 15:24:08 +0200 |
| commit | fc5ced75d6dffc9e2a441520b7dc587b95281f86 (patch) | |
| tree | 9b24b900aeb4d8174677204b7aa171d4a8afd98c /kernel/task_work.c | |
| parent | a85df8c7b5ee2d3d4823befada42c5c41aff4cb0 (diff) | |
| parent | 4d95a12beba146b0ca2de59c7ce905bc0aadfd0c (diff) | |
Merge drm/drm-fixes into drm-misc-fixes
Backmerging to get the latest fixes from upstream.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'kernel/task_work.c')
| -rw-r--r-- | kernel/task_work.c | 15 |
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); |
