diff options
| author | Zhenghang Xiao <kipreyyy@gmail.com> | 2026-05-26 18:31:21 +0800 |
|---|---|---|
| committer | David Heidelberg <david@ixit.cz> | 2026-08-11 18:10:02 +0200 |
| commit | 8265a626cc14a48e46e6dc8c47667e72b4232ac2 (patch) | |
| tree | e05ff876ba509e9146153e4445e21c5a27710b3b /tools/perf/scripts/python/flamegraph.py | |
| parent | 36812527052c5bfb1ec6c1e292d67a5bf76b750f (diff) | |
nfc: nci: fix double completion race in nci_data_exchange_complete
nci_close_device() and nci_rx_work can both call
nci_data_exchange_complete() concurrently. After commit 4527025d440ce8
("nfc: nci: fix circular locking dependency in nci_close_device") moved
flush_workqueue(ndev->rx_wq) after mutex_unlock(&ndev->req_lock),
rx_work is no longer serialized with the explicit completion call in the
close path. Both callers read the non-NULL callback pointer and invoke
rawsock_data_exchange_complete(), which calls sock_put() -- but only one
sock_hold() was taken, so the second sock_put() underflows the refcount
and frees the socket while it is still in use.
Replace the bare clear_bit(NCI_DATA_EXCHANGE) with
test_and_clear_bit() so that only the first caller proceeds to invoke
the callback.
Fixes: 4527025d440c ("nfc: nci: fix circular locking dependency in nci_close_device")
Signed-off-by: Zhenghang Xiao <kipreyyy@gmail.com>
Link: https://patch.msgid.link/20260526103121.47957-1-kipreyyy@gmail.com
Signed-off-by: David Heidelberg <david@ixit.cz>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
