Using sk_set_owner and having THIS_MODULE in the struct proto_ops registered
with the core.
sk = sk_alloc(PF_KEY, GFP_KERNEL, 1, NULL);
if (sk == NULL)
goto out;
-
+
sock->ops = &pfkey_ops;
sock_init_data(sock, sk);
+ sk_set_owner(sk, THIS_MODULE);
err = -ENOMEM;
pfk = pfkey_sk(sk) = kmalloc(sizeof(*pfk), GFP_KERNEL);
static struct proto_ops pfkey_ops = {
.family = PF_KEY,
-
+ .owner = THIS_MODULE,
/* Operations that make no sense on pfkey sockets. */
.bind = sock_no_bind,
.connect = sock_no_connect,