Skip to content
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

l2cap: adjust the order of the code #590

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

weigangw
Copy link
Contributor

l2cap_handle_channel_open_failed in l2cap.c will create packet to upper level. And if upper level do something to get channel ptr, it may cause dangling pointer after l2cap_free_channel_entry was called.

Since the channel ptr was always gotten through "l2cap_channels", we can remove channel from the list first to avoid that.

@mringwal
Copy link
Member

Hi @weigangw, you're right about this. We generally try to first remove a connection from the list, free it and then emit the packet to the higher layer. I'm traveling the next week and try to figure out if there has been a reason why this code first emits the event and then releases the connection struct.

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