Using sk_set_owner and having THIS_MODULE in the struct proto_ops
registered with the core. The sk_set_owner cases are in the callers
of tp->af_specific->syn_recv_sock so as to not have spurious extra
sk_set_owner calls in the ipv6 code that reuses ipv4 code.
inet->id = 0;
sock_init_data(sock, sk);
+ sk_set_owner(sk, THIS_MODULE);
sk->destruct = inet_sock_destruct;
sk->zapped = 0;
struct proto_ops inet_stream_ops = {
.family = PF_INET,
-
+ .owner = THIS_MODULE,
.release = inet_release,
.bind = inet_bind,
.connect = inet_stream_connect,
struct proto_ops inet_dgram_ops = {
.family = PF_INET,
-
+ .owner = THIS_MODULE,
.release = inet_release,
.bind = inet_bind,
.connect = inet_dgram_connect,
struct sock *child;
child = tp->af_specific->syn_recv_sock(sk, skb, req, dst);
- if (child)
+ if (child) {
+ sk_set_owner(child, sk->owner);
tcp_acceptq_queue(sk, req, child);
- else
+ } else
tcp_openreq_free(req);
return child;
if (child == NULL)
goto listen_overflow;
+ sk_set_owner(child, sk->owner);
tcp_synq_unlink(tp, req, prev);
tcp_synq_removed(sk, req);