linux/net/nfc
Lin Ma 86cdf8e387 NFC: reorganize the functions in nci_request
There is a possible data race as shown below:

thread-A in nci_request()       | thread-B in nci_close_device()
                                | mutex_lock(&ndev->req_lock);
test_bit(NCI_UP, &ndev->flags); |
...                             | test_and_clear_bit(NCI_UP, &ndev->flags)
mutex_lock(&ndev->req_lock);    |
                                |

This race will allow __nci_request() to be awaked while the device is
getting removed.

Similar to commit e2cb6b891a ("bluetooth: eliminate the potential race
condition when removing the HCI controller"). this patch alters the
function sequence in nci_request() to prevent the data races between the
nci_close_device().

Signed-off-by: Lin Ma <linma@zju.edu.cn>
Fixes: 6a2968aaf5 ("NFC: basic NCI protocol implementation")
Link: https://lore.kernel.org/r/20211115145600.8320-1-linma@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-11-17 20:16:53 -08:00
..
hci nfc: drop unneeded debug prints 2021-10-11 17:00:51 -07:00
nci NFC: reorganize the functions in nci_request 2021-11-17 20:16:53 -08:00
af_nfc.c nfc: fix error handling of nfc_proto_register() 2021-10-13 17:32:38 -07:00
core.c
digital.h
digital_core.c NFC: digital: fix possible memory leak in digital_tg_listen_mdaa() 2021-10-13 17:44:29 -07:00
digital_dep.c
digital_technology.c NFC: digital: fix possible memory leak in digital_in_send_sdd_req() 2021-10-13 17:44:29 -07:00
Kconfig
llcp.h
llcp_commands.c nfc: drop unneeded debug prints 2021-10-11 17:00:51 -07:00
llcp_core.c nfc: drop unneeded debug prints 2021-10-11 17:00:51 -07:00
llcp_sock.c
Makefile
netlink.c NFC: add necessary privilege flags in netlink layer 2021-11-03 11:15:18 +00:00
nfc.h
rawsock.c