CVE-2026-55275 AI-generated analysis
platform/hardware/nxp/nfc, NXP NFC HAL TML reader (pn8x/halimpl/tml/phTmlNfc.cc, snxxx/halimpl/tml/phTmlNfc.cc, and on Android 17 also snxxx/halimpl_v2/tml/phTmlNfc.cc)
Clears the dangling tReadInfo.pBuffer pointer in phTmlNfc_ReadAbort() and adds NULL checks in phTmlNfc_TmlThread() before the memcpy, the retransmission header check and phNxpNciHal_print_packet in the pn8x and snxxx NXP NFC HAL TML layers, so a late I2C frame after a read abort is no longer written into a freed buffer.
Root cause
phTmlNfc_TmlThread() blocks in phTmlNfc_i2c_read() reading into a local temp buffer. On success it memcpys the data into gpphTmlNfc_Context->tReadInfo.pBuffer, reads pBuffer[0] for the retransmission check and passes pBuffer to phNxpNciHal_print_packet. phTmlNfc_ReadAbort() did not clear tReadInfo.pBuffer. Per the commit message, a firmware download timeout can cause that heap buffer to be freed while the reader thread is still blocked in the I2C read. If a late frame then arrives from the NFCC or an I2C interposer, the reader thread writes dwNoBytesWrRd bytes into the freed allocation (in pn8x, reads larger than 260 bytes are rejected before this point).
How the fix works
- pn8x/halimpl/tml/phTmlNfc.cc:phTmlNfc_ReadAbort and snxxx/halimpl/tml/phTmlNfc.cc:phTmlNfc_ReadAbort: after tReadInfo.bThreadBusy = false, set gpphTmlNfc_Context->tReadInfo.pBuffer = NULL so the context no longer references the caller's (possibly freed) buffer.
- pn8x/halimpl/tml/phTmlNfc.cc:phTmlNfc_TmlThread and snxxx/halimpl/tml/phTmlNfc.cc:phTmlNfc_TmlThread: in the successful-read branch, wrap memcpy(tReadInfo.pBuffer, temp, dwNoBytesWrRd) in an `if (tReadInfo.pBuffer != NULL)` check. In pn8x this memcpy runs under readInfoUpdateMutex; in snxxx no lock is visible in the diff context.
- Same functions: add `(tReadInfo.pBuffer != NULL) &&` to the retransmission condition before reading tReadInfo.pBuffer[0] & 0xE0, so the timer-stop logic is skipped when pBuffer is NULL.
- Same functions: guard the phNxpNciHal_print_packet("RECV", pBuffer, wLength) call with the same NULL check. tReadInfo.wLength is still updated and bEnable is still reset to 0 regardless of pBuffer.
- Android 17 commit ba66d3b8e2cf also adds the phTmlNfc_ReadAbort pBuffer = NULL change to snxxx/halimpl_v2/tml/phTmlNfc.cc. It makes no phTmlNfc_TmlThread changes in that file.
Completeness
- Covers the three uses of tReadInfo.pBuffer in the successful-read branch of phTmlNfc_TmlThread (memcpy, pBuffer[0] retransmission check, print_packet) in pn8x and snxxx halimpl. It clears the pointer in phTmlNfc_ReadAbort in both files, and also in halimpl_v2 on Android 17.
- The pointer clearing works only if phTmlNfc_ReadAbort runs before the buffer is freed. A path that frees the read buffer without calling phTmlNfc_ReadAbort is not covered by it.
- In pn8x the NULL check and memcpy run under readInfoUpdateMutex; the diff does not show whether phTmlNfc_ReadAbort takes the same mutex. In snxxx halimpl no mutex is visible around the check and memcpy in the shown context. The material therefore does not show that the check and the use are atomic with respect to a concurrent abort.
- The Android 16 commit does not touch snxxx/halimpl_v2 even though its commit message mentions snxxx_v2. The Android 17 commit adds only the ReadAbort change there, not the TmlThread checks. The material does not show whether halimpl_v2 exists on Android 16, or whether its phTmlNfc_TmlThread needs the same guards.
- The code after the patched region (the callback/message posting that consumes tReadInfo.pBuffer and wLength) is not shown, so it is unknown whether a NULL pBuffer with a nonzero wLength is handled safely downstream.
Behavior changes
- After phTmlNfc_ReadAbort, a frame received by the reader thread is no longer copied into the previous caller buffer, is not logged through phNxpNciHal_print_packet, and does not stop the retransmission timer. How the rest of the read path handles it is not shown.
- phTmlNfc_ReadAbort now leaves tReadInfo.pBuffer NULL. On a late read, tReadInfo.bEnable is still reset and wLength is still updated.
Per major
- Android 14: Not listed by the bulletin. The resolver reports 8/8 lines of the patched region present at android-security-14.0.0_r31. The material shows no separate commit.
- Android 15: Not listed by the bulletin. The resolver reports 8/8 lines of the patched region present at android-security-15.0.0_r19. The material shows no separate commit.
- Android 16: Same fix: commit aacd4775c722 in android-security-16.0.0_r10 (cherry-pick of a0d57e70d8ca). It touches only pn8x/halimpl/tml/phTmlNfc.cc and snxxx/halimpl/tml/phTmlNfc.cc; 8/8 lines present.
- Android 17: Adapted fix: commit ba66d3b8e2cf in android-security-17.0.0_r3 has the same pn8x and snxxx halimpl hunks, plus the phTmlNfc_ReadAbort pBuffer = NULL line in snxxx/halimpl_v2/tml/phTmlNfc.cc; 8/8 lines present.
Unknowns
- The caller path that frees the read buffer after the firmware download timeout is not shown; only the commit message describes it, and it does not say whether that path calls phTmlNfc_ReadAbort.
- Whether phTmlNfc_ReadAbort holds readInfoUpdateMutex (pn8x) or any lock (snxxx) while clearing pBuffer, and so whether the check and memcpy are atomic with respect to the abort.
- Whether snxxx/halimpl_v2 exists on Android 16 and whether its phTmlNfc_TmlThread has equivalent unguarded uses of tReadInfo.pBuffer.
- How the code after the patched region (callback posting with tReadInfo.pBuffer / wLength) behaves when pBuffer is NULL.
- Where tReadInfo.pBuffer is set again for the next read request.
- The snxxx read size limit (PH_TMLNFC_MAX_READ_NCI_BUFF_LEN value and size check).
- Why the Android 14 and 15 tags contain the patched lines although the bulletin does not list them.