-
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
Fix null-deref crash in OnSessionEstablishmentError. #14654
Fix null-deref crash in OnSessionEstablishmentError. #14654
Conversation
Why aren't we using |
PR #14654: Size comparison from 9de9890 to f7b0e7a Increases (2 builds for linux)
Decreases (34 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, qpg)
Full report (41 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the fix, but note that on a BLE peripheral closing a BLE endpoint doesn't automatically drops the BLE connection (don't know what's the reason, but see the code:
connectedhomeip/src/ble/BLEEndPoint.cpp
Line 469 in cb9b046
if (mConnStateFlags.Has(ConnectionStateFlag::kAutoClose)) |
BLEManagerImpl::NotifyChipConnectionClosed
which is not implemented by most platforms (I just added an implementation for Zephyr yesterday).
Because this code doesn't really have a connection object around.... I could try to figure out where it could get one, if you prefer. |
Indeed, that is a problem the old code had too. |
It's fine. This is better than crashing. |
Never mind. I was thinking of CancelBleIncompleteConnection. |
We ended up crashing because mServer->getBleLayerObject()->mBleEndPoint was null. The changes mostly remove the changes from project-chip#9845 because those changes made us try to close some random "whatever last BLE endpoint was created", even if it's already closed or has nothing to do with our PASE session. So instead, just do the same thing as we do for CASE establishment and tear down all BLE sessions, if we need to tear down anything at all. The remaining changes are making ReleaseBleConnection private again and removing the broken mBleEndPoint member from BleLayer.
f7b0e7a
to
49e55f4
Compare
PR #14654: Size comparison from 8bb93af to 49e55f4 Increases (3 builds for esp32, linux)
Decreases (34 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg)
Full report (43 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
We ended up crashing because
mServer->getBleLayerObject()->mBleEndPoint was null.
The changes mostly remove the changes from #9845 because those changes
made us try to close some random "whatever last BLE endpoint was
created", even if it's already closed or has nothing to do with our
PASE session.
So instead, just do the same thing as we do for CASE establishment and
tear down all BLE sessions, if we need to tear down anything at all.
The remaining changes are making ReleaseBleConnection private again
and removing the broken mBleEndPoint member from BleLayer.
Problem
See above.
Change overview
See above.
Testing
Not entirely sure how to test this. #9845 did not have clear test steps.... @sweetymhaiske