-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Bluetooth: Classic: L2CAP: Reset rx.cid when channel is deleted #94633
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
Conversation
rootcause: The dynamic L2CAP channel rx.cid is not reset, it will be intercepted by the judgment condition of the fixed channel, directly using the last alloced cid may cause cid conflict. Signed-off-by: zhenwei fang <fangzhenwei@bytedance.com>
454691f to
78a6dca
Compare
|
| bt_l2cap_br_chan_set_state(chan, BT_L2CAP_DISCONNECTED); | ||
| BR_CHAN(chan)->psm = 0U; | ||
| if (L2CAP_BR_CID_IS_DYN(BR_CHAN(chan)->rx.cid)) { | ||
| BR_CHAN(chan)->rx.cid = 0U; |
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.
need to reset all rx bt_l2cap_br_endpoint?
will tx enpoint be the potential problems?
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.
tx enpoint don't need
|
@Frozen935 , Why did you close this PR? |
CI build break, and I force pushed the rebase, this PR can't reopen. I will submit a new PR later. |
|
I crated a #98473 for the changes of this PR. |



Rootcause: the dynamic L2CAP channel rx.cid is not reset, it will be intercepted by the judgment condition of the fixed channel, directly using the last alloced cid may cause cid conflict.
For example, the first BR L2CAP channel is an SDP service, and the chan requested from bt_sdp_pool occupies cid 0x40. When the sdp connection is disconnected, it will be removed from the conn->channels list, but the bt_sdp_pool[0] cid field is not cleanup. A new service request may be A2DP or HFP, which will request cid 0x40. When the next sdp service request is received, the chan rx.cid received will not be 0, and this chan will be used directly instead of dynamically requesting a new cid, which will cause a cid conflict.