All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Cgroups <cgroups@vger.kernel.org>
Subject: [PATCH 2/2] cpuset: fix a race condition in __cpuset_node_allowed_softwall()
Date: Thu, 27 Feb 2014 18:19:36 +0800	[thread overview]
Message-ID: <530F1138.2090903@huawei.com> (raw)
In-Reply-To: <530F1117.1020605@huawei.com>

It's not safe to access task's cpuset after releasing task_lock().
Holding callback_mutex won't help.

Cc: <stable@vger.kernel.org>
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 kernel/cpuset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 5f50ec6..c63a0d9 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2412,9 +2412,9 @@ int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
 
 	task_lock(current);
 	cs = nearest_hardwall_ancestor(task_cs(current));
+	allowed = node_isset(node, cs->mems_allowed);
 	task_unlock(current);
 
-	allowed = node_isset(node, cs->mems_allowed);
 	mutex_unlock(&callback_mutex);
 	return allowed;
 }
-- 
1.8.0.2

  reply	other threads:[~2014-02-27 10:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 10:19 [PATCH 1/2] cpuset: fix a locking issue in cpuset_migrate_mm() Li Zefan
2014-02-27 10:19 ` Li Zefan
2014-02-27 10:19 ` Li Zefan [this message]
     [not found]   ` <530F1138.2090903-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-02-27 14:40     ` [PATCH 2/2] cpuset: fix a race condition in __cpuset_node_allowed_softwall() Tejun Heo
2014-02-27 14:40       ` Tejun Heo
     [not found] ` <530F1117.1020605-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-02-27 10:29   ` [PATCH 1/2] cpuset: fix a locking issue in cpuset_migrate_mm() Li Zefan
2014-02-27 10:29     ` Li Zefan
2014-02-27 14:37   ` Tejun Heo
2014-02-27 14:37     ` Tejun Heo

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=530F1138.2090903@huawei.com \
    --to=lizefan@huawei.com \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.