summaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2006-02-13 15:51:24 -0800
committerDavid S. Miller <davem@davemloft.net>2006-02-13 15:51:24 -0800
commite200bd8065e4db6297cd8db071a9188cf9aa6b56 (patch)
tree80c9ced19aa5a0fa0cc9be69d34ca45cf92394ad /net/netlink
parent178a3259f2508e786fb1bd6538365a167cee35c1 (diff)
downloadlinux-e200bd8065e4db6297cd8db071a9188cf9aa6b56.tar.bz2
[NETLINK] genetlink: Fix bugs spotted by Andrew Morton.
- panic() doesn't return. - Don't forget to unlock on genl_register_family() error path - genl_rcv_msg() is called via pointer so there's no point in declaring it `inline'. Notes: genl_ctrl_event() ignores the genlmsg_multicast() return value. lots of things ignore the genl_ctrl_event() return value. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/genetlink.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 4ae1538c54a9..43e72419c868 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -238,7 +238,7 @@ int genl_register_family(struct genl_family *family)
sizeof(struct nlattr *), GFP_KERNEL);
if (family->attrbuf == NULL) {
err = -ENOMEM;
- goto errout;
+ goto errout_locked;
}
} else
family->attrbuf = NULL;
@@ -288,7 +288,7 @@ int genl_unregister_family(struct genl_family *family)
return -ENOENT;
}
-static inline int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
+static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
int *errp)
{
struct genl_ops *ops;
@@ -375,7 +375,7 @@ static void genl_rcv(struct sock *sk, int len)
do {
if (genl_trylock())
return;
- netlink_run_queue(sk, &qlen, &genl_rcv_msg);
+ netlink_run_queue(sk, &qlen, genl_rcv_msg);
genl_unlock();
} while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen);
}
@@ -549,10 +549,8 @@ static int __init genl_init(void)
netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV);
genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID,
genl_rcv, THIS_MODULE);
- if (genl_sock == NULL) {
+ if (genl_sock == NULL)
panic("GENL: Cannot initialize generic netlink\n");
- return -ENOMEM;
- }
return 0;
@@ -560,7 +558,6 @@ errout_register:
genl_unregister_family(&genl_ctrl);
errout:
panic("GENL: Cannot register controller: %d\n", err);
- return err;
}
subsys_initcall(genl_init);