linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT pull] irq/urgent for v5.6
@ 2020-03-29 16:03 Thomas Gleixner
  2020-03-29 16:03 ` [GIT pull] x86/urgent " Thomas Gleixner
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Thomas Gleixner @ 2020-03-29 16:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, x86

Linus,

please pull the latest irq/urgent branch from:

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

up to:  df81dfcfd699: genirq: Fix reference leaks on irq affinity notifiers

A single bugfix to prevent reference leaks in irq affinity notifiers.

Thanks,

	tglx

------------------>
Edward Cree (1):
      genirq: Fix reference leaks on irq affinity notifiers


 kernel/irq/manage.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 7eee98c38f25..fe40c658f86f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -323,7 +323,11 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask,
 
 	if (desc->affinity_notify) {
 		kref_get(&desc->affinity_notify->kref);
-		schedule_work(&desc->affinity_notify->work);
+		if (!schedule_work(&desc->affinity_notify->work)) {
+			/* Work was already scheduled, drop our extra ref */
+			kref_put(&desc->affinity_notify->kref,
+				 desc->affinity_notify->release);
+		}
 	}
 	irqd_set(data, IRQD_AFFINITY_SET);
 
@@ -423,7 +427,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
 	raw_spin_unlock_irqrestore(&desc->lock, flags);
 
 	if (old_notify) {
-		cancel_work_sync(&old_notify->work);
+		if (cancel_work_sync(&old_notify->work)) {
+			/* Pending work had a ref, put that one too */
+			kref_put(&old_notify->kref, old_notify->release);
+		}
 		kref_put(&old_notify->kref, old_notify->release);
 	}
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-29 18:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-29 16:03 [GIT pull] irq/urgent for v5.6 Thomas Gleixner
2020-03-29 16:03 ` [GIT pull] x86/urgent " Thomas Gleixner
2020-03-29 17:34   ` Linus Torvalds
2020-03-29 18:06     ` Thomas Gleixner
2020-03-29 16:03 ` [GIT pull] timers/urgent " Thomas Gleixner
2020-03-29 18:05   ` pr-tracker-bot
2020-03-29 16:03 ` [GIT pull] perf/urgent " Thomas Gleixner
2020-03-29 17:36   ` Linus Torvalds
2020-03-29 18:05 ` [GIT pull] irq/urgent " pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).