Commit 8aa4666e authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[NETLINK]: Check netlink_insert in kernel_create

This patch checks the return value of netlink_insert() in
netlink_kernel_create().  It could fail if someone loads
the same module twice for instance.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb637cb2
...@@ -868,7 +868,10 @@ netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len)) ...@@ -868,7 +868,10 @@ netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len))
if (input) if (input)
nlk_sk(sk)->data_ready = input; nlk_sk(sk)->data_ready = input;
netlink_insert(sk, 0); if (netlink_insert(sk, 0)) {
sock_release(sock);
return NULL;
}
return sk; return sk;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment