[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZSkUlkp214AROxpG@gondor.apana.org.au>
Date: Fri, 13 Oct 2023 17:57:42 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Wang Jinchao <wangjinchao@...sion.com>
Cc: steffen.klassert@...unet.com, daniel.m.jordan@...cle.com,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
stone.xulei@...sion.com
Subject: Re: [PATCH v3] Fixes: 07928d9bfc81 ("padata: Remove broken queue
flushing")
Wang Jinchao <wangjinchao@...sion.com> wrote:
>
> diff --git a/kernel/padata.c b/kernel/padata.c
> index 222d60195de6..79d04a97ded6 100644
> --- a/kernel/padata.c
> +++ b/kernel/padata.c
> @@ -1102,12 +1102,16 @@ EXPORT_SYMBOL(padata_alloc_shell);
> */
> void padata_free_shell(struct padata_shell *ps)
> {
> + struct parallel_data *pd;
> +
> if (!ps)
> return;
>
> mutex_lock(&ps->pinst->lock);
> list_del(&ps->list);
> - padata_free_pd(rcu_dereference_protected(ps->pd, 1));
> + pd = rcu_dereference_protected(ps->pd, 1);
> + if (refcount_dec_and_test(&pd->refcnt))
> + padata_free_pd(rcu_dereference_protected(ps->pd, 1));
Why is this dereferencing ps->pd again after the refcount_dec_and_test?
If this is necessary please explain it in the code because it is not
at all obvious.
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists