host/l2cap: disconnect if received packet is larger than MPS#1003
Merged
sjanc merged 1 commit intoapache:masterfrom Apr 13, 2022
Merged
host/l2cap: disconnect if received packet is larger than MPS#1003sjanc merged 1 commit intoapache:masterfrom
sjanc merged 1 commit intoapache:masterfrom
Conversation
rymanluk
requested changes
Jul 21, 2021
| goto err; | ||
| } | ||
|
|
||
| if (l2cap_hdr.len > chan->my_coc_mps) { |
Contributor
There was a problem hiding this comment.
what about ATT ? in such a case chan->my_coc_mps is 0 I believe. Or not?
Contributor
Author
There was a problem hiding this comment.
Yes, I think you are right. What's more, I think only dynamic range CIDs use my_coc_mps field, and for others MPS=MTU of channel, which varies from channel to channel. I added 3 cases for BLE_L2CAP_CID_ATT, BLE_L2CAP_CID_SIG and BLE_L2CAP_CID_SM.
23e7100 to
3892443
Compare
rymanluk
reviewed
Jul 23, 2021
| goto err; | ||
| } | ||
|
|
||
| if ((chan->dcid >= 0x0040 && chan->dcid <= 0x007F && l2cap_hdr.len > chan->my_coc_mps) || |
Contributor
There was a problem hiding this comment.
@KKopyscinski don't you want just add ble_l2cap_disconnect(chan); after line 413 ?
Peer sending packet larger than MPS is invalid, and should be met with L2CAP channel disconnection. This affects L2CAP/LE/CFC/BV-27-C
3892443 to
319390b
Compare
Contributor
Author
|
@sjanc as discussed offline, only CIDs from dynamic range are checked now |
sjanc
approved these changes
Nov 16, 2021
5 tasks
sjanc
approved these changes
Apr 13, 2022
This file contains hidden or 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
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.
Peer sending packet larger than MPS is invalid, and should be met
with L2CAP channel disconnection.
This affects L2CAP/LE/CFC/BV-27-C