Discussion:
Mismatched mutex_enter in tcp_input.c/syn_cache_get ?
(too old to reply)
je
2012-03-21 01:05:16 UTC
Permalink
While looking through the tcp syn cache code I noticed near the end of
syn_cache_get in tcp_input.c there is a branch of code for handling
errors that calls mutex_enter(softnet_lock), but I can't find a matching
call to mutex_exit anywhere. Is this a bug, am I not seeing the exit, or
am I not understanding the softnet_lock mutex system?

For reference, the mutex_enter call in question is on line 4242 of
tcp_input.c version 1.321.

Thanks!
John

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Manuel Bouyer
2012-03-21 09:40:58 UTC
Permalink
Post by je
While looking through the tcp syn cache code I noticed near the end
of syn_cache_get in tcp_input.c there is a branch of code for
handling errors that calls mutex_enter(softnet_lock), but I can't
find a matching call to mutex_exit anywhere. Is this a bug, am I not
seeing the exit, or am I not understanding the softnet_lock mutex
system?
For reference, the mutex_enter call in question is on line 4242 of
tcp_input.c version 1.321.
as I understand it (but I may be wrong, this code is complicated and
poorly documented), syn_cache_get() is called with softnet_lock held.
sonewconn() will allocate a new socket and its lock will be softnet_lock.
In the code you point out, soabort() will release so->so_lock, which is
softnet_lock. So softnet_lock has been released, we have to get it again.
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...