Skip to content

Allow registerring callbacks for a valid handle only - #210

Closed
kstribrnAmzn wants to merge 2 commits into
FreeRTOS:mainfrom
kstribrnAmzn:registerForValidHandleOnly
Closed

kstribrnAmzn wants to merge 2 commits into
FreeRTOS:mainfrom
kstribrnAmzn:registerForValidHandleOnly

Conversation

@kstribrnAmzn

@kstribrnAmzn kstribrnAmzn commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

A valid/live handle will have an entry in the overall cellular context. Verify the handle has an entry before registerring a callback.

We thank Myeonghun Pak and Seongmin Kim for their help identifying this issue.

Test Steps

Validating with unit tests for now. I'd like to validate a batch of changes on hardware as I haven't setup the cellular boards before.
11/23/26: I've created a testing harness to verify end to end behavior which mocks hardware. It's results are as follows:

210 stale-handle/dataready   main      FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterDataReadyCallback cellular_common_api.c:499)
210 stale-handle/open        main      FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterSocketOpenCallback cellular_common_api.c:529)
210 stale-handle/closed      main      FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterClosedCallback cellular_common_api.c:559)
211 shutdown/normal          main      FAIL  heap-use-after-free (in _pktioReadThread cellular_pktio.c:1256)
211 shutdown/openfail        main      FAIL  heap-use-after-free (in _pktioReadThread cellular_pktio.c:1256)
210 stale-handle/dataready   pr210     PASS
210 stale-handle/open        pr210     PASS
210 stale-handle/closed      pr210     PASS
211 shutdown/normal          pr210     FAIL  heap-use-after-free (in _pktioReadThread cellular_pktio.c:1256)
211 shutdown/openfail        pr210     FAIL  heap-use-after-free (in _pktioReadThread cellular_pktio.c:1256)
210 stale-handle/dataready   pr211     FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterDataReadyCallback cellular_common_api.c:499)
210 stale-handle/open        pr211     FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterSocketOpenCallback cellular_common_api.c:529)
210 stale-handle/closed      pr211     FAIL  heap-use-after-free (in Cellular_CommonSocketRegisterClosedCallback cellular_common_api.c:559)
211 shutdown/normal          pr211     PASS
211 shutdown/openfail        pr211     PASS

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

A valid/live handle will have an entry in the overall
cellular context. Verify the handle has an entry before
registerring a callback.

We thank Myeonghun Pak and Seongmin Kim for their help identifying this issue.
@kstribrnAmzn
kstribrnAmzn marked this pull request as ready for review October 26, 2026 21:39
Comment thread source/cellular_common_api.c Resolved
@kstribrnAmzn
kstribrnAmzn deleted the registerForValidHandleOnly branch November 24, 2026 17:23
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