Re: [PATCH] NFC: nxp-nci: fix deadlock between firmware download and IRQ handler

David Heidelberg <[email protected]> Sun, 19 Jul 2026 13:45:44 +0200
Newsgroups dev.linux.lists.oe-linux-nfc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 24/06/2026 17:56, Ian Ray wrote:
> The firmware download work function holds `info_lock' while calling the
> nxp_nci_fw_send(), which waits for a completion.
> 
> The completion is signalled by the IRQ thread handler, which also takes
> `info_lock', causing a deadlock.
> 
> Fix by dropping the mutex while waiting for the completion.
> 
> Signed-off-by: Ian Ray <[email protected]>
> ---
>   drivers/nfc/nxp-nci/firmware.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 

Hello Ian!

Thanks for your submission, could you add Fixes tag and Cc for stable?

Thank you
David

> diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c
> index a9533977aff8..38fcac26ce56 100644
> --- a/drivers/nfc/nxp-nci/firmware.c
> +++ b/drivers/nfc/nxp-nci/firmware.c
> @@ -154,8 +154,13 @@ static int nxp_nci_fw_send(struct nxp_nci_info *info)
>   		if (fw_info->fw)
>   			schedule_work(&fw_info->work);
>   	} else {
> +		mutex_unlock(&info->info_lock);
> +
>   		completion_rc = wait_for_completion_interruptible_timeout(
>   			&fw_info->cmd_completion, NXP_NCI_FW_ANSWER_TIMEOUT);
> +
> +		mutex_lock(&info->info_lock);
> +
>   		if (completion_rc == 0)
>   			return -ETIMEDOUT;
>   	}

-- 
David Heidelberg