-
Notifications
You must be signed in to change notification settings - Fork 280
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
base: master
Are you sure you want to change the base?
Assert if soref() is called on an already-released socket. #703
Conversation
e719a63
to
5d461ee
Compare
++(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; \ |
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.
If we actually do this, sofree()
will return early, since so->so_count != 0
would be true.
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.
Yes, you're right; see my follow-up commit.
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.
Please fix merge conflict.
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.
I've rebased it.
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. |
9dd75f8
to
6a60d87
Compare
No description provided.