[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00252573-b6ac-4172-eb54-ce20d49a033b@linaro.org>
Date: Thu, 19 May 2022 10:58:44 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Duoming Zhou <duoming@....edu.cn>, netdev@...r.kernel.org
Cc: davem@...emloft.net, gregkh@...uxfoundation.org,
alexander.deucher@....com, broonie@...nel.org,
linux-kernel@...r.kernel.org, kuba@...nel.org, edumazet@...gle.com,
pabeni@...hat.com
Subject: Re: [PATCH net v3] NFC: hci: fix sleep in atomic context bugs in
nfc_hci_hcp_message_tx
On 18/05/2022 13:57, Duoming Zhou wrote:
> There are sleep in atomic context bugs when the request to secure
> element of st21nfca is timeout. The root cause is that kzalloc and
> alloc_skb with GFP_KERNEL parameter and mutex_lock are called in
> st21nfca_se_wt_timeout which is a timer handler. The call tree shows
> the execution paths that could lead to bugs:
>
> (Interrupt context)
> st21nfca_se_wt_timeout
> nfc_hci_send_event
> nfc_hci_hcp_message_tx
> kzalloc(..., GFP_KERNEL) //may sleep
> alloc_skb(..., GFP_KERNEL) //may sleep
> mutex_lock() //may sleep
>
> This patch moves the operations that may sleep into a work item.
> The work item will run in another kernel thread which is in
> process context to execute the bottom half of the interrupt.
> So it could prevent atomic context from sleeping.
>
> Fixes: 2130fb97fecf ("NFC: st21nfca: Adding support for secure element")
> Signed-off-by: Duoming Zhou <duoming@....edu.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Best regards,
Krzysztof
Powered by blists - more mailing lists