From: Daeseok Youn <daeseok.youn@gmail.com>
To: tj@kernel.org
Cc: laijs@cn.fujitsu.com, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] workqueue: fix bugs in wq_update_unbound_numa() failure path
Date: Wed, 16 Apr 2014 14:11:32 +0900 [thread overview]
Message-ID: <20140416051126.GA12288@devel> (raw)
wq_update_unbound_numa() failure path has the following two bugs.
- alloc_unbound_pwq() is called without holding wq->mutex;
however, if the allocation fails, it jumps to out_unlock
which tries to unlock wq->mutex.
- The function should switch to dfl_pwq on failure
but didn't do so after alloc_unbound_pwq() failure.
Fix it by regrabbing wq->mutex and jumping to use_dfl_pwq on
alloc_unbound_pwq() failure.
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
kernel/workqueue.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0ee63af..3150b21 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4100,7 +4100,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
if (!pwq) {
pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
wq->name);
- goto out_unlock;
+ mutex_lock(&wq->mutex);
+ goto use_dfl_pwq;
}
/*
--
1.7.4.4
next reply other threads:[~2014-04-16 5:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 5:11 Daeseok Youn [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-04-16 5:22 [PATCH 1/2] workqueue: fix bugs in wq_update_unbound_numa() failure path Daeseok Youn
2014-04-16 5:32 Daeseok Youn
2014-04-16 16:22 ` Lai Jiangshan
2014-04-16 17:30 ` 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=20140416051126.GA12288@devel \
--to=daeseok.youn@gmail.com \
--cc=laijs@cn.fujitsu.com \
--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.