]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
nfc: nci: clear NCI_DATA_EXCHANGE before calling completion callback
authorJakub Kicinski <kuba@kernel.org>
Tue, 3 Mar 2026 16:23:44 +0000 (08:23 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2026 02:18:57 +0000 (18:18 -0800)
commit0efdc02f4f6d52f8ca5d5889560f325a836ce0a8
tree9916c27cdd5d1e5d7ef81631b41e4c482565fcdd
parent66083581945bd5b8e99fe49b5aeb83d03f62d053
nfc: nci: clear NCI_DATA_EXCHANGE before calling completion callback

Move clear_bit(NCI_DATA_EXCHANGE) before invoking the data exchange
callback in nci_data_exchange_complete().

The callback (e.g. rawsock_data_exchange_complete) may immediately
schedule another data exchange via schedule_work(tx_work).  On a
multi-CPU system, tx_work can run and reach nci_transceive() before
the current nci_data_exchange_complete() clears the flag, causing
test_and_set_bit(NCI_DATA_EXCHANGE) to return -EBUSY and the new
transfer to fail.

This causes intermittent flakes in nci/nci_dev in NIPA:

  # #  RUN           NCI.NCI1_0.t4t_tag_read ...
  # # t4t_tag_read: Test terminated by timeout
  # #          FAIL  NCI.NCI1_0.t4t_tag_read
  # not ok 3 NCI.NCI1_0.t4t_tag_read

Fixes: 38f04c6b1b68 ("NFC: protect nci_data_exchange transactions")
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260303162346.2071888-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/nfc/nci/data.c