From 2c123db44d2e5daa7c6012fa43715d99706c84a5 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 28 May 2019 10:42:15 +0200 Subject: [PATCH 270/328] genirq: Handle missing work_struct in irq_set_affinity_notifier() Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.106-rt46.tar.xz [ Upstream commit bbc4d2a7d6ff54ba923640d9a42c7bef7185fe98 ] The backported stable commit 59c39840f5abf ("genirq: Prevent use-after-free and work list corruption") added cancel_work_sync() on a work_struct element which is not available in RT. Replace cancel_work_sync() with kthread_cancel_work_sync() on RT. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Steven Rostedt (VMware) --- kernel/irq/manage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -415,13 +415,14 @@ raw_spin_unlock_irqrestore(&desc->lock, flags); if (old_notify) { -#ifndef CONFIG_PREEMPT_RT_BASE - /* Need to address this for PREEMPT_RT */ +#ifdef CONFIG_PREEMPT_RT_BASE + if (kthread_cancel_work_sync(¬ify->work)) { +#else if (cancel_work_sync(&old_notify->work)) { +#endif /* Pending work had a ref, put that one too */ kref_put(&old_notify->kref, old_notify->release); } -#endif kref_put(&old_notify->kref, old_notify->release); }