On Fri, 2006-03-02 at 16:34 -0800, David S. Miller wrote:
> Can someone look into the holes found in the genetlink code
> Andrew mentions below?


> "how come the return value from genlmsg_multicast() gets ignored" 

Sometimes the users dont care about the return code; i.e if the message
doesnt make it fine. You should look at if you care about reliability of
delivery and perhaps retransmit when it makes sense.

> "how come i takes the address of an inline function" 
Didnt quiet follow

> "how come genl_register_family() leaves genl_sem held if kmalloc
>failed" and "how come there's a return statement after panic() which
>is marked NORET_TYPE".

certainly bugs. patch attached.

PS:- I have a doc i started working on - will look it up and post

cheers,
jamal
Fix genetlink bugs found by Sir Andrew Morton

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
---

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 4ae1538..8cbad1d 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -238,7 +238,7 @@ int genl_register_family(struct genl_fam
                                        sizeof(struct nlattr *), GFP_KERNEL);
                if (family->attrbuf == NULL) {
                        err = -ENOMEM;
-                       goto errout;
+                       goto errout_locked;
                }
        } else
                family->attrbuf = NULL;
@@ -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);

Reply via email to