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

Assert if soref() is called on an already-released socket. #703

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JonathanLennox
Copy link
Contributor

No description provided.

++(so)->so_count; \
} while (0)

#define sorele(so) do { \
ACCEPT_LOCK_ASSERT(); \
SOCK_LOCK_ASSERT(so); \
KASSERT((so)->so_count > 0, ("sorele")); \
if (--(so)->so_count == 0) \
if (--(so)->so_count == 0) { \
(so)->so_count = -1; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we actually do this, sofree() will return early, since so->so_count != 0 would be true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right; see my follow-up commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix merge conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rebased it.

@JonathanLennox
Copy link
Contributor Author

The reason for this PR is to try to track down the issue I reported in #676 -- the garbage value in so_count implies that the memory has been re-used, for which the most likely explanation is that the socket has been freed.

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.

3 participants