Re: [PATCH] crypto: mxs-dcp - Fix softirq locking and completion
From: Herbert Xu
Date: Fri Nov 20 2026 - 04:49:31 EST
On Mon, Nov 09, 2026 at 11:38:38AM +0100, Tomas Paukrt wrote:
> The request queues are protected by plain spin_lock(), but requests are
> enqueued from softirq context (e.g. by ESP on packet receive) as well as
> from process context, while the channel threads dequeue them in process
> context with bottom halves enabled. A softirq that runs on the same CPU
> while the lock is held either deadlocks on SMP, or corrupts the queue on
> UP where the spinlock does not provide any protection.
>
> In addition, the channel threads call the completion callbacks with
> bottom halves enabled, although the crypto API requires them to be
> called with bottom halves disabled. With IPsec, esp_input_done() then
> runs xfrm_input() and gro_cells_receive() in plain process context,
> which races with the NET_RX softirq on the per-CPU GRO cell queue and on
> the xfrm state, and defers the NAPI poll until the next interrupt.
>
> This was observed with strongSwan on i.MX6ULL: the throughput drops
> quickly and eventually no packets are decrypted at all.
>
> Fix this by taking the queue locks with spin_lock_bh() and by calling
> the completion callbacks with bottom halves disabled.
>
> Fixes: 15b59e7c3733 ("crypto: mxs - Add Freescale MXS DCP driver")
> Signed-off-by: Tomas Paukrt <tomaspaukrt@xxxxxxxx>
> ---
> drivers/crypto/mxs-dcp.c | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt