linux/net/nfc/nci
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
..
core.c NFC: reorganize the functions in nci_request 2021-11-17 20:16:53 -08:00
data.c nfc: nci: constify several pointers to u8, sk_buff and other structs 2021-07-30 17:22:52 +02:00
hci.c nfc: drop unneeded debug prints 2021-10-11 17:00:51 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
lib.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntf.c nfc: drop unneeded debug prints 2021-10-11 17:00:51 -07:00
rsp.c nfc: nci: fix the UAF of rf_conn_info object 2021-10-08 17:24:32 +01:00
spi.c nfc: nci: constify several pointers to u8, sk_buff and other structs 2021-07-30 17:22:52 +02:00
uart.c TTY / Serial driver update for 5.16-rc1 2021-11-04 09:09:37 -07:00