Merge tag 'irq-urgent-2020-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fix from Thomas Gleixner:
"A single bugfix to prevent reference leaks in irq affinity notifiers"

* tag 'irq-urgent-2020-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
genirq: Fix reference leaks on irq affinity notifiers

Changed files
+9 -2
kernel
irq
+9 -2
kernel/irq/manage.c
··· 323 323 324 324 if (desc->affinity_notify) { 325 325 kref_get(&desc->affinity_notify->kref); 326 - schedule_work(&desc->affinity_notify->work); 326 + if (!schedule_work(&desc->affinity_notify->work)) { 327 + /* Work was already scheduled, drop our extra ref */ 328 + kref_put(&desc->affinity_notify->kref, 329 + desc->affinity_notify->release); 330 + } 327 331 } 328 332 irqd_set(data, IRQD_AFFINITY_SET); 329 333 ··· 427 423 raw_spin_unlock_irqrestore(&desc->lock, flags); 428 424 429 425 if (old_notify) { 430 - cancel_work_sync(&old_notify->work); 426 + if (cancel_work_sync(&old_notify->work)) { 427 + /* Pending work had a ref, put that one too */ 428 + kref_put(&old_notify->kref, old_notify->release); 429 + } 431 430 kref_put(&old_notify->kref, old_notify->release); 432 431 } 433 432