mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: qzhang2 <qiang.zhang@windriver.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	Lai Jiangshan <jiangshanlai@gmail.com>, Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] workqueue: Fix double kfree(rescuer) in destroy_workqueue()
Date: Mon, 25 May 2020 14:28:28 +0800	[thread overview]
Message-ID: <d9dd0dc2-e169-6a63-9a79-d692994324f1@windriver.com> (raw)
In-Reply-To: <96b49f22-50a7-9c8f-7c9d-f178195de717@web.de>

Sorry I didn't describe clearly

I describe the meaning as follows:

	destroy_workqueue
		if(wq->rescuer)
			struct worker *rescuer = wq->rescuer
			kfree(rescuer)
		..................
                 if (!(wq->flags & WQ_UNBOUND))
			call_rcu(&wq->rcu, rcu_free_wq)
			......................
			rcu_free_wq
				kfree(wq->rescuer)

there are double free.

On 5/24/20 11:33 PM, Markus Elfring wrote:
>> 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.
> 
> 1. I suggest to improve also this change description.
>     Do you try to explain here that a call of the function “free_workqueue_attrs”
>     (or “free_percpu”) would perform sufficient clean-up of system resources
>     in this use case?
> 
> 2. You proposed to delete the function call “kfree(wq->rescuer)” from
>     the implementation of the function “rcu_free_wq”.
>     https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/kernel/workqueue.c?id=c11d28ab4a691736e30b49813fb801847bd44e83#n3482
>     https://elixir.bootlin.com/linux/v5.7-rc6/source/kernel/workqueue.c#L3482
> 
>     This function name should be specified also in the patch subject,
>     shouldn't it?
> 
> 3. Would you like to add the tag “Fixes” to the commit message?
> 
> Regards,
> Markus
> 

  reply	other threads:[~2020-05-25  6:28 UTC|newest]

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

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=d9dd0dc2-e169-6a63-9a79-d692994324f1@windriver.com \
    --to=qiang.zhang@windriver.com \
    --cc=Markus.Elfring@web.de \
    --cc=jiangshanlai@gmail.com \
    --cc=kernel-janitors@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 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®