Skip to content

nfc: nxp-nci: do not hold info_lock across nci_unregister_device() - #68

Closed
W4HO-ham wants to merge 1 commit into
derekross:omamobilefrom
W4HO-ham:nfc-nxp-nci-remove-deadlock-v2
Closed

W4HO-ham wants to merge 1 commit into
derekross:omamobilefrom
W4HO-ham:nfc-nxp-nci-remove-deadlock-v2

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

This is #61 again. You merged it on 2026-10-26 at 23:23 UTC, but the omamobile branch on GitHub doesn't have it now: the merge commit isn't an ancestor of omamobile, and the file still has the old code. My guess is that the branch was republished after the merge from a tree without it.

Same commit, cherry-picked onto the current omamobile with no conflicts. checkpatch --strict is clean and the file builds with W=1. #61 and #59 were merged together and are both missing, so I'm resubmitting each.

nxp_nci_remove() takes info_lock and then calls nci_unregister_device().
If the device is up, nci_unregister_device() closes it through
nci_close_device() and the driver's close hook, nxp_nci_close(), which
takes info_lock again. The mutex is not recursive, so removing a powered
device hangs: the unbind or rmmod never returns, and a later shutdown
blocks in device_shutdown().

Seen on a Pixel 9a whose NFC controller is driven through this I2C
transport: with the controller powered by neard, the device's removal
during a suspend attempt hung with nxp_nci_close() under
nxp_nci_remove().

Unregister first, outside the lock, then put the chip in cold mode under
the lock, and free the device last.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
@derekross

Copy link
Copy Markdown
Owner

Thanks for checking, but this one is already on omamobile: it landed when I merged #61 yesterday at 23:23 UTC, as 29abc5e4dc70. GitHub's rebase merge gives the commit a new id, so #61's head (4906aca2c809) is not an ancestor and there is no merge commit to look for, but the change is there. git show 29abc5e4dc70 | git patch-id matches your 3e5980f4d2a0 exactly, drivers/nfc/nxp-nci/core.c on omamobile has the nci_unregister_device() call before the lock with your comment above it, and merging this PR onto today's branch produces no diff. The branch hasn't been force-pushed since; I'd guess a stale local fetch.

The same goes for #67: your pinctrl commit is 3e2ebfddcd9a on the branch. I'll close both; nothing to redo on your side. Your other NFC changes (#70, #71) are reviewed separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants