[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb566eb7-c571-9a51-af51-78e36412fbfc@linaro.org>
Date: Wed, 18 May 2022 11:39:27 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: duoming@....edu.cn
Cc: linux-kernel@...r.kernel.org, kuba@...nel.org, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com, gregkh@...uxfoundation.org,
alexander.deucher@....com, broonie@...nel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net v2] NFC: hci: fix sleep in atomic context bugs in
nfc_hci_hcp_message_tx
On 18/05/2022 06:39, duoming@....edu.cn wrote:
>> There is.
>>
>> nfc_hci_failure -> spin lock -> nfc_driver_failure -> nfc_targets_found
>> -> device_lock
>>
>> I found it just by a very quick look, so I suspect there are several
>> other places, not really checked.
>
> I agree with you, the spin_lock is not a good solution to this problem. There is another solution:
>
> We could put the nfc_hci_send_event() of st21nfca_se_wt_timeout() in a work item, then, using
> schedule_work() in st21nfca_se_wt_timeout() to execute the work item. The schedule_work() will
> wake up another kernel thread which is in process context to execute the bottom half of the interrupt,
> so it allows sleep.
>
> The following is the details.
Yes, this seems good solution. You might also need to add
cancel_work_sync to all places removing the timer.
Best regards,
Krzysztof
Powered by blists - more mailing lists