diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2006-02-13 18:51:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-02-13 18:51:24 -0500 |
commit | e200bd8065e4db6297cd8db071a9188cf9aa6b56 (patch) | |
tree | 80c9ced19aa5a0fa0cc9be69d34ca45cf92394ad | |
parent | 178a3259f2508e786fb1bd6538365a167cee35c1 (diff) |
[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>
-rw-r--r-- | net/netlink/genetlink.c | 11 |
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) | |||
238 | sizeof(struct nlattr *), GFP_KERNEL); | 238 | sizeof(struct nlattr *), GFP_KERNEL); |
239 | if (family->attrbuf == NULL) { | 239 | if (family->attrbuf == NULL) { |
240 | err = -ENOMEM; | 240 | err = -ENOMEM; |
241 | goto errout; | 241 | goto errout_locked; |
242 | } | 242 | } |
243 | } else | 243 | } else |
244 | family->attrbuf = NULL; | 244 | family->attrbuf = NULL; |
@@ -288,7 +288,7 @@ int genl_unregister_family(struct genl_family *family) | |||
288 | return -ENOENT; | 288 | return -ENOENT; |
289 | } | 289 | } |
290 | 290 | ||
291 | static inline int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | 291 | static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, |
292 | int *errp) | 292 | int *errp) |
293 | { | 293 | { |
294 | struct genl_ops *ops; | 294 | struct genl_ops *ops; |
@@ -375,7 +375,7 @@ static void genl_rcv(struct sock *sk, int len) | |||
375 | do { | 375 | do { |
376 | if (genl_trylock()) | 376 | if (genl_trylock()) |
377 | return; | 377 | return; |
378 | netlink_run_queue(sk, &qlen, &genl_rcv_msg); | 378 | netlink_run_queue(sk, &qlen, genl_rcv_msg); |
379 | genl_unlock(); | 379 | genl_unlock(); |
380 | } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); | 380 | } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); |
381 | } | 381 | } |
@@ -549,10 +549,8 @@ static int __init genl_init(void) | |||
549 | netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); | 549 | netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); |
550 | genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, | 550 | genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, |
551 | genl_rcv, THIS_MODULE); | 551 | genl_rcv, THIS_MODULE); |
552 | if (genl_sock == NULL) { | 552 | if (genl_sock == NULL) |
553 | panic("GENL: Cannot initialize generic netlink\n"); | 553 | panic("GENL: Cannot initialize generic netlink\n"); |
554 | return -ENOMEM; | ||
555 | } | ||
556 | 554 | ||
557 | return 0; | 555 | return 0; |
558 | 556 | ||
@@ -560,7 +558,6 @@ errout_register: | |||
560 | genl_unregister_family(&genl_ctrl); | 558 | genl_unregister_family(&genl_ctrl); |
561 | errout: | 559 | errout: |
562 | panic("GENL: Cannot register controller: %d\n", err); | 560 | panic("GENL: Cannot register controller: %d\n", err); |
563 | return err; | ||
564 | } | 561 | } |
565 | 562 | ||
566 | subsys_initcall(genl_init); | 563 | subsys_initcall(genl_init); |