mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Bart Van Assche <bvanassche@acm.org>,
	"Ingo Molnar" <mingo@kernel.org>, Tejun Heo <tj@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH] workqueue, lockdep: Fix new alloc_workqueue() error path
Date: Mon, 18 Mar 2019 19:58:33 +0800	[thread overview]
Message-ID: <20190318115833.67468-1-wangkefeng.wang@huawei.com> (raw)

If alloc_workqueue_attrs() fails, the workqueue lockdep is
uninitialized, it will trigger a warning in err_free_wq path
when try to unregister workqueue lockdep.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 009bb421b6ce ("workqueue, lockdep: Fix an alloc_workqueue() error path")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 kernel/workqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4026d1871407..2c19f2968bc7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4242,7 +4242,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
 	if (flags & WQ_UNBOUND) {
 		wq->unbound_attrs = alloc_workqueue_attrs(GFP_KERNEL);
 		if (!wq->unbound_attrs)
-			goto err_free_wq;
+			goto err_unbound_attrs;
 	}
 
 	va_start(args, max_active);
@@ -4296,6 +4296,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
 	wq_unregister_lockdep(wq);
 	wq_free_lockdep(wq);
 	free_workqueue_attrs(wq->unbound_attrs);
+err_unbound_attrs:
 	kfree(wq);
 	return NULL;
 err_destroy:
-- 
2.20.1


             reply	other threads:[~2019-03-18 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 11:58 Kefeng Wang [this message]
2019-03-18 12:32 ` Kefeng Wang

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=20190318115833.67468-1-wangkefeng.wang@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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 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®