lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyCC+oLV3iqP7ZEU+x0BRcQiKYm6sYmAFTmOemJOJubayg@mail.gmail.com>
Date:   Sun, 10 May 2020 18:33:26 +0800
From:   Lai Jiangshan <jiangshanlai@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Tejun Heo <tj@...nel.org>, Sean Fu <fxinrong@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] workqueue: Fix an use after free in init_rescuer()

Reviewed-by: Lai Jiangshan <jiangshanlai@...il.com>

On Fri, May 8, 2020 at 11:07 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> We need to preserve error code before freeing "rescuer".
>
> Fixes: f187b6974f6df ("workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO.")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> Another option would be to just revert the original commit.
>
>  kernel/workqueue.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index ddf0537dce140..10ed8d761e0b7 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -4197,6 +4197,7 @@ static int wq_clamp_max_active(int max_active, unsigned int flags,
>  static int init_rescuer(struct workqueue_struct *wq)
>  {
>         struct worker *rescuer;
> +       int ret;
>
>         if (!(wq->flags & WQ_MEM_RECLAIM))
>                 return 0;
> @@ -4208,8 +4209,9 @@ static int init_rescuer(struct workqueue_struct *wq)
>         rescuer->rescue_wq = wq;
>         rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
>         if (IS_ERR(rescuer->task)) {
> +               ret = PTR_ERR(rescuer->task);
>                 kfree(rescuer);
> -               return PTR_ERR(rescuer->task);
> +               return ret;
>         }
>
>         wq->rescuer = rescuer;
> --
> 2.26.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ