summaryrefslogtreecommitdiff
path: root/net/nfc/core.c
diff options
context:
space:
mode:
authorLin Ma <linma@zju.edu.cn>2021-11-15 17:56:00 +0300
committerJakub Kicinski <kuba@kernel.org>2021-11-18 07:16:53 +0300
commit86cdf8e38792545161dbe3350a7eced558ba4d15 (patch)
tree993f3eb88e7320334cf6776cf8413263ddb049a3 /net/nfc/core.c
parent3e6db079751afd527bf3db32314ae938dc571916 (diff)
downloadlinux-86cdf8e38792545161dbe3350a7eced558ba4d15.tar.xz
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 e2cb6b891ad2 ("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: 6a2968aaf50c ("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>
Diffstat (limited to 'net/nfc/core.c')
0 files changed, 0 insertions, 0 deletions