From: Andrey Vagin <avagin@openvz.org>
To: Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
Oleg Nesterov <oleg@tv-sign.ru>,
Pavel Emelyanov <xemul@openvz.org>,
Andrey Vagin <avagin@openvz.org>
Subject: [PATCH 2/2] posix_timer: clean up properly if anything fails after *_timer_create
Date: Fri, 14 May 2010 17:28:51 +0400 [thread overview]
Message-ID: <1273843731-12595-2-git-send-email-avagin@openvz.org> (raw)
In-Reply-To: <1273843731-12595-1-git-send-email-avagin@openvz.org>
*_timer_create may allocate/get some resources, so need call *_timer_cleanup.
https://bugzilla.sw.ru/show_bug.cgi?id=473702
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
kernel/posix-timers.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 1195668..8d7cb0e 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -574,19 +574,19 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
if (copy_to_user(created_timer_id,
&new_timer_id, sizeof (new_timer_id))) {
error = -EFAULT;
- goto out;
+ goto out_cleanup;
}
if (timer_event_spec) {
if (copy_from_user(&event, timer_event_spec, sizeof (event))) {
error = -EFAULT;
- goto out;
+ goto out_cleanup;
}
rcu_read_lock();
new_timer->it_pid = get_pid(good_sigevent(&event));
rcu_read_unlock();
if (!new_timer->it_pid) {
error = -EINVAL;
- goto out;
+ goto out_cleanup;
}
} else {
event.sigev_notify = SIGEV_SIGNAL;
@@ -613,6 +613,8 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
* and may cease to exist at any time. Don't use or modify
* new_timer after the unlock call.
*/
+out_cleanup:
+ CLOCK_DISPATCH(new_timer->it_clock, timer_cleanup, (new_timer));
out:
release_posix_timer(new_timer, it_id_set);
return error;
--
1.6.6
next prev parent reply other threads:[~2010-05-14 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-14 13:28 [PATCH 1/2] posix_timer: separate timer_cleanup from timer_del Andrey Vagin
2010-05-14 13:28 ` Andrey Vagin [this message]
2010-05-14 16:03 ` [PATCH 2/2] posix_timer: clean up properly if anything fails after *_timer_create Oleg Nesterov
2010-05-14 17:18 ` Stanislaw Gruszka
2010-05-14 18:48 ` Oleg Nesterov
2010-05-15 14:17 ` Andrew Vagin
2010-05-14 16:01 ` [PATCH 1/2] posix_timer: separate timer_cleanup from timer_del Oleg Nesterov
2010-05-24 21:40 ` [stable] " Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273843731-12595-2-git-send-email-avagin@openvz.org \
--to=avagin@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®