Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1295595
| From | tip-bot for Thomas Gleixner <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:locking/core] futex: Drop refcount if requeue_pi() acquired the rtmutex |
| Date | 2015-12-20 14:30 +0100 |
| Message-ID | <qHMdI-17i-33@gated-at.bofh.it> (permalink) |
| References | <qHvZg-7LF-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: fb75a4282d0d9a3c7c44d940582c2d226cf3acfb
Gitweb: http://git.kernel.org/tip/fb75a4282d0d9a3c7c44d940582c2d226cf3acfb
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 19 Dec 2015 20:07:38 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 20 Dec 2015 12:43:24 +0100
futex: Drop refcount if requeue_pi() acquired the rtmutex
If the proxy lock in the requeue loop acquires the rtmutex for a
waiter then it acquired also refcount on the pi_state related to the
futex, but the waiter side does not drop the reference count.
Add the missing free_pi_state() call.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <darren@dvhart.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Bhuvanesh_Surachari@mentor.com
Cc: Andy Lowe <Andy_Lowe@mentor.com>
Link: http://lkml.kernel.org/r/20151219200607.178132067@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
---
kernel/futex.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/futex.c b/kernel/futex.c
index 684d754..24fbc77 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2755,6 +2755,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
if (q.pi_state && (q.pi_state->owner != current)) {
spin_lock(q.lock_ptr);
ret = fixup_pi_state_owner(uaddr2, &q, current);
+ /*
+ * Drop the reference to the pi state which
+ * the requeue_pi() code acquired for us.
+ */
+ free_pi_state(q.pi_state);
spin_unlock(q.lock_ptr);
}
} else {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch 0/5] futex: Plug a pi_state leak and clarify the refcounting Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:10 +0100
[patch 5/5] futex: Cleanup the goto confusion in requeue_pi() Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:10 +0100
Re: [patch 5/5] futex: Cleanup the goto confusion in requeue_pi() Darren Hart <dvhart@infradead.org> - 2015-12-20 06:20 +0100
Re: [patch 5/5] futex: Cleanup the goto confusion in requeue_pi() Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-12-20 06:50 +0100
Re: [patch 5/5] futex: Cleanup the goto confusion in requeue_pi() Darren Hart <dvhart@infradead.org> - 2015-12-20 08:40 +0100
Re: [patch 5/5] futex: Cleanup the goto confusion in requeue_pi() Darren Hart <dvhart@infradead.org> - 2015-12-20 06:50 +0100
[tip:locking/core] futex: Cleanup the goto confusion in requeue_pi() tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-12-20 14:30 +0100
[patch 3/5] futex: Document pi_state refcounting in requeue code Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:10 +0100
Re: [patch 3/5] futex: Document pi_state refcounting in requeue code Darren Hart <dvhart@infradead.org> - 2015-12-20 08:50 +0100
[tip:locking/core] futex: Document pi_state refcounting in requeue code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-12-20 14:30 +0100
[patch 1/5] futex: Drop refcount if requeue_pi() acquired the rtmutex Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:10 +0100
[tip:locking/core] futex: Drop refcount if requeue_pi() acquired the rtmutex tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-12-20 14:30 +0100
[patch 2/5] futex: Rename free_pi_state() to put_pi_state() Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:10 +0100
[tip:locking/core] futex: Rename free_pi_state() to put_pi_state( ) tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-12-20 14:30 +0100
[patch 4/5] futex: Remove pointless put_pi_state calls in requeue() Thomas Gleixner <tglx@linutronix.de> - 2015-12-19 21:20 +0100
[tip:locking/core] futex: Remove pointless put_pi_state calls in requeue() tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-12-20 14:30 +0100
csiph-web