WSL2-Linux-Kernel/drivers/nfc
Duoming Zhou a89ca82d6b NFC: hci: fix sleep in atomic context bugs in nfc_hci_hcp_message_tx
[ Upstream commit b413b0cb00 ]

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: 2130fb97fe ("NFC: st21nfca: Adding support for secure element")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220518115733.62111-1-duoming@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:23:01 +02:00
..
fdp
microread
nfcmrvl nfc: nfcmrvl: main: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs 2022-05-12 12:30:10 +02:00
nxp-nci
pn533 nfc: pn533: Fix buggy cleanup order 2022-06-06 08:43:36 +02:00
pn544
s3fwrn5
st-nci
st21nfca NFC: hci: fix sleep in atomic context bugs in nfc_hci_hcp_message_tx 2022-06-09 10:23:01 +02:00
st95hf
Kconfig
Makefile
mei_phy.c
mei_phy.h
nfcsim.c
port100.c NFC: port100: fix use-after-free in port100_send_complete 2022-03-16 14:23:39 +01:00
trf7970a.c
virtual_ncidev.c