public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bsdacct: delete timer with sync intension
@ 2010-03-25 14:35 Vitaliy Gusev
  2010-03-31 19:56 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaliy Gusev @ 2010-03-25 14:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Pavel Emelyanov, linux-kernel

acct_exit_ns --> acct_file_reopen deletes timer without
check timer execution on other CPUs. So acct_timeout() can
change an unmapped memory.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

---
 kernel/acct.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index a6605ca..6ac80ca 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -353,17 +353,18 @@ restart:
 
 void acct_exit_ns(struct pid_namespace *ns)
 {
-	struct bsd_acct_struct *acct;
+	struct bsd_acct_struct *acct = ns->bacct;
 
-	spin_lock(&acct_lock);
-	acct = ns->bacct;
-	if (acct != NULL) {
-		if (acct->file != NULL)
-			acct_file_reopen(acct, NULL, NULL);
+	if (acct == NULL)
+		return;
 
-		kfree(acct);
-	}
+	del_timer_sync(&acct->timer);
+	spin_lock(&acct_lock);
+	if (acct->file != NULL)
+		acct_file_reopen(acct, NULL, NULL);
 	spin_unlock(&acct_lock);
+
+	kfree(acct);
 }
 
 /*

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

end of thread, other threads:[~2010-03-31 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 14:35 [PATCH] bsdacct: delete timer with sync intension Vitaliy Gusev
2010-03-31 19:56 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox