mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <qiang.zhang@windriver.com>
To: <tj@kernel.org>
Cc: <jiangshanlai@gmail.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] workqueue: Fix double kfree(rescuer) in destroy_workqueue()
Date: Sun, 24 May 2020 17:22:43 +0800	[thread overview]
Message-ID: <20200524092243.19083-1-qiang.zhang@windriver.com> (raw)

From: Zhang Qiang <qiang.zhang@windriver.com>

When destroy_workqueue if rescuer worker exist,wq->rescuer pointer be
kfree. if sanity checks passed. the func call_rcu(&wq->rcu, rcu_free_wq)
will be called if the wq->flags & WQ_UNBOUND is false,in rcu_free_wq
func wq->rescuer pointer was kfree again.

Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
---
 kernel/workqueue.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 891ccad5f271..a2451cdcd503 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3491,7 +3491,6 @@ static void rcu_free_wq(struct rcu_head *rcu)
 	else
 		free_workqueue_attrs(wq->unbound_attrs);
 
-	kfree(wq->rescuer);
 	kfree(wq);
 }
 
-- 
2.17.0


             reply	other threads:[~2020-05-24  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24  9:22 qiang.zhang [this message]
2020-05-24 15:33 Markus Elfring
2020-05-25  6:28 ` qzhang2
2020-05-25  6:43 ` qzhang2
2020-05-25  7:04   ` Markus Elfring

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=20200524092243.19083-1-qiang.zhang@windriver.com \
    --to=qiang.zhang@windriver.com \
    --cc=jiangshanlai@gmail.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 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®