-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IM]Fix leaked readClient in onFabricRemoved call #37199
Merged
yunhanw-google
merged 7 commits into
project-chip:master
from
yunhanw-google:feature/fix_leak_read_client
Jan 27, 2025
Merged
[IM]Fix leaked readClient in onFabricRemoved call #37199
yunhanw-google
merged 7 commits into
project-chip:master
from
yunhanw-google:feature/fix_leak_read_client
Jan 27, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yunhanw-google
force-pushed
the
feature/fix_leak_read_client
branch
from
January 24, 2025 22:57
22e6f64
to
e332076
Compare
PR #37199: Size comparison from 74593dc to e332076 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
yunhanw-google
force-pushed
the
feature/fix_leak_read_client
branch
from
January 25, 2025 00:53
e332076
to
1fff786
Compare
PR #37199: Size comparison from fd216ec to 1fff786 Full report (44 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, nrfconnect, psoc6, qpg, stm32, telink, tizen)
|
When ReadClient::Close is called from onFabricRemove in InteractionModel Engine, readClient is destoryed and becomes not valid so that readClient->GetNextClient() will be use-after-free.
yunhanw-google
force-pushed
the
feature/fix_leak_read_client
branch
from
January 25, 2025 01:49
1fff786
to
225475b
Compare
PR #37199: Size comparison from fd216ec to 17dbffa Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #37199: Size comparison from fd216ec to 3db18a8 Full report (56 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
PR #37199: Size comparison from fd216ec to 76f432a Full report (3 builds for cc32xx, stm32)
|
yunhanw-google
force-pushed
the
feature/fix_leak_read_client
branch
from
January 25, 2025 06:09
517b2f3
to
733c26f
Compare
--Remove unnecessary chip::Test and chip::app and app namespace Restyled by clang-format
yunhanw-google
force-pushed
the
feature/fix_leak_read_client
branch
from
January 25, 2025 06:10
733c26f
to
c099f16
Compare
andy31415
reviewed
Jan 27, 2025
andy31415
approved these changes
Jan 27, 2025
bzbarsky-apple
approved these changes
Jan 27, 2025
PR #37199: Size comparison from 5dee683 to 9d451c5 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
This was referenced Jan 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When ReadClient::Close is called from onFabricRemove in InteractionModel Engine, readClient is destoryed and becomes not valid so that readClient->GetNextClient() will be use-after-free.
Fixes #36920
Testing
Add unit test to cover this, where we create multiple subscriptions, then we remove fabric,
Without this change, the unit test would fail since the problematic loop code in onFabricRemoved cannot continue and numActiveReadClient cannot decrease to 0 after removing fabric, with this change, the numActiveReadClient can decrease to 0.