nfc_fw_download() marks an asynchronous download active before calling the driver, but it does not reject a second request while that download is running. If the driver rejects the second request, the core clears fw_download_in_progress and makes the first operation appear complete. Check the state while holding the NFC device lock and return -EBUSY without modifying it. Asynchronous completion remains lockless because a driver may report completion while holding a driver-private lock and the start path invokes the driver while holding the device lock. Discovered during an AI-assisted source audit using OpenAI Codex, gpt-5.6-sol. The overlapping-download condition was reproduced at runtime by issuing two NFC_CMD_FW_DOWNLOAD requests to a pty-backed controller. After this change the second request returned -EBUSY without disturbing the first. No production incident or pre-fix kernel warning was observed. Patch development and test planning used the same assistant. No physical NFC controller was available. Fixes: 9674da8759df ("NFC: Add firmware upload netlink command") Cc: stable@vger.kernel.org Assisted-by: LLM (OpenAI Codex, gpt-5.6-sol) Signed-off-by: Shubham Antil --- net/nfc/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/nfc/core.c b/net/nfc/core.c index 91b3274da..b03b34b40 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c @@ -48,6 +48,11 @@ int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) goto error; } + if (READ_ONCE(dev->fw_download_in_progress)) { + rc = -EBUSY; + goto error; + } + if (!dev->ops->fw_download) { rc = -EOPNOTSUPP; goto error; -- 2.54.0