genirq: Prevent use-after-free and work list corruption
[platform/kernel/linux-rpi.git] / kernel / irq / manage.c
index 5c0ba5c..cd4f9f3 100644 (file)
@@ -356,8 +356,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
        desc->affinity_notify = notify;
        raw_spin_unlock_irqrestore(&desc->lock, flags);
 
-       if (old_notify)
+       if (old_notify) {
+               cancel_work_sync(&old_notify->work);
                kref_put(&old_notify->kref, old_notify->release);
+       }
 
        return 0;
 }