Skip to contentSkip to conversation

Correct procedure to close an in-kernel TCP socket

DISCUSSION Martin Lucina 1 participant 1 message Apr 6, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

We're having some problems with code that uses in-kernel TCP sockets created with sock_create_kern().

At the moment we are doing this when closing a socket:

	write_lock_bh(&s->sk->sk_callback_lock);
	s->sk->sk_state_change = old_sk_state_change;
	s->sk->sk_data_ready = old_sk_data_ready;
	s->sk->sk_write_space = old_sk_write_space;
	write_unlock_bh(&s->sk->sk_callback_lock);

        /* ... */
	
        sock_release(s);

We then see that at some point in the future our s->sk->sk_state_change callback is still being called despite the code above restoring the original values.

Is there something we're doing wrong?

Thanks,

-mato