tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Mismatched mutex_enter in tcp_input.c/syn_cache_get ?

On Tue, Mar 20, 2012 at 06:05:16PM -0700, je wrote:
> 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 <>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index