From: Tejun Heo <tj@kernel.org>
To: Yifan Zhang <zhangyf@marvell.com>
Cc: Jing Xiang <jxiang@marvell.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: fix a workqueue kernel panic issue.
Date: Sun, 21 Sep 2014 23:39:46 -0400 [thread overview]
Message-ID: <20140922033946.GA23583@htj.dyndns.org> (raw)
In-Reply-To: <4737A960563B524DA805CA602BE04B307EEE6C2694@SC-VEXCH2.marvell.com>
On Sun, Sep 21, 2014 at 08:30:32PM -0700, Yifan Zhang wrote:
> Hi Tejun,
>
> What's do you think of this patch ? Any concern ?
Hmmm? Haven't I already responded to this patch?
> -----Original Message-----
> From: Yifan Zhang [mailto:zhangyf@marvell.com]
> Sent: 2014年9月17日 16:18
> To: Tejun Heo; Jing Xiang; linux-kernel@vger.kernel.org
> Cc: Yifan Zhang
> Subject: [PATCH] workqueue: fix a workqueue kernel panic issue.
>
> if created workqueue in multi-thread unsynchronized,
Can you please elaborate?
> get_work_pwq() may return NULL, which cause kernel panic. Judge get_work_pwq() return value before use
> pwq->wq->flags.
>
> Signed-off-by: Yifan Zhang <zhangyf@marvell.com>
> ---
> kernel/workqueue.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 5dbe22a..d3ac87f 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1947,9 +1947,19 @@ __acquires(&pool->lock) {
> struct pool_workqueue *pwq = get_work_pwq(work);
> struct worker_pool *pool = worker->pool;
> - bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
> + bool cpu_intensive;
> int work_color;
> struct worker *collision;
> +
> + if (pwq == NULL) {
> + pr_err("BUG: invalid struct work_struct.data %lu\n",
> + atomic_long_read(&work->data));
> + dump_stack();
> + return;
I have difficult time seeing how the above piece of code would be
acceptable but maybe the situation you're trying to explain is weird
enough to justify it.
Thanks.
--
tejun
next prev parent reply other threads:[~2014-09-22 3:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1410941884-26034-1-git-send-email-zhangyf@marvell.com>
2014-09-22 3:30 ` [PATCH] workqueue: fix a workqueue kernel panic issue Yifan Zhang
2014-09-22 3:39 ` Tejun Heo [this message]
2014-09-22 10:40 ` Yifan Zhang
2014-09-23 14:33 ` 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=20140922033946.GA23583@htj.dyndns.org \
--to=tj@kernel.org \
--cc=jxiang@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangyf@marvell.com \
/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;
as well as URLs for NNTP newsgroup(s).