[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y4COvhZ6hqPK6hBT@gondor.apana.org.au>
Date: Fri, 25 Nov 2022 17:45:34 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Daniel Jordan <daniel.m.jordan@...cle.com>
Cc: Steffen Klassert <steffen.klassert@...unet.com>,
Nicolai Stange <nstange@...e.de>,
Martin Doucha <mdoucha@...e.cz>, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] padata: Always leave BHs disabled when running
->parallel()
On Wed, Nov 16, 2022 at 08:28:02PM -0500, Daniel Jordan wrote:
> A deadlock can happen when an overloaded system runs ->parallel() in the
> context of the current task:
>
> padata_do_parallel
> ->parallel()
> pcrypt_aead_enc/dec
> padata_do_serial
> spin_lock(&reorder->lock) // BHs still enabled
> <interrupt>
> ...
> __do_softirq
> ...
> padata_do_serial
> spin_lock(&reorder->lock)
>
> It's a bug for BHs to be on in _do_serial as Steffen points out, so
> ensure they're off in the "current task" case like they are in
> padata_parallel_worker to avoid this situation.
>
> Reported-by: syzbot+bc05445bc14148d51915@...kaller.appspotmail.com
> Fixes: 4611ce224688 ("padata: allocate work structures for parallel jobs from a pool")
> Signed-off-by: Daniel Jordan <daniel.m.jordan@...cle.com>
> Acked-by: Steffen Klassert <steffen.klassert@...unet.com>
> ---
>
> About the potential deadlock in padata_find_next(), I think this fix
> covers us there since that function is only called from
> padata_do_serial(), where BHs should now always be off, or
> invoke_padata_reorder(), where BHs are off as well. The _bh spinlock
> variants in padata_reorder() seem redundant.
>
> kernel/padata.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Patch applied. 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