[PATCH] genetlink: don't touch module ref count
authorPer Liden <per.liden@ericsson.com>
Fri, 13 Jan 2006 21:06:40 +0000 (13:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Jan 2006 21:06:40 +0000 (13:06 -0800)
Increasing the module ref count at registration will block the module from
ever being unloaded. In fact, genetlink should not care about the owner at
all. This patch removes the owner field from the struct registered with
genetlink.

Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/genetlink.h
net/netlink/genetlink.c
net/tipc/netlink.c

index c5b96b2b81554e452630774254c1a2ae4e9a9f34..805de50df00da8255f02edc3757e440654d16762 100644 (file)
@@ -22,7 +22,6 @@ struct genl_family
        char                    name[GENL_NAMSIZ];
        unsigned int            version;
        unsigned int            maxattr;
        char                    name[GENL_NAMSIZ];
        unsigned int            version;
        unsigned int            maxattr;
-       struct module *         owner;
        struct nlattr **        attrbuf;        /* private */
        struct list_head        ops_list;       /* private */
        struct list_head        family_list;    /* private */
        struct nlattr **        attrbuf;        /* private */
        struct list_head        ops_list;       /* private */
        struct list_head        family_list;    /* private */
index 3b1378498d50b12647f2ea433a341b16502e1ac9..4ae1538c54a9397505d8ae3e74eb19eba6c50337 100644 (file)
@@ -222,11 +222,6 @@ int genl_register_family(struct genl_family *family)
                goto errout_locked;
        }
 
                goto errout_locked;
        }
 
-       if (!try_module_get(family->owner)) {
-               err = -EBUSY;
-               goto errout_locked;
-       }
-
        if (family->id == GENL_ID_GENERATE) {
                u16 newid = genl_generate_id();
 
        if (family->id == GENL_ID_GENERATE) {
                u16 newid = genl_generate_id();
 
@@ -283,7 +278,6 @@ int genl_unregister_family(struct genl_family *family)
                INIT_LIST_HEAD(&family->ops_list);
                genl_unlock();
 
                INIT_LIST_HEAD(&family->ops_list);
                genl_unlock();
 
-               module_put(family->owner);
                kfree(family->attrbuf);
                genl_ctrl_event(CTRL_CMD_DELFAMILY, family);
                return 0;
                kfree(family->attrbuf);
                genl_ctrl_event(CTRL_CMD_DELFAMILY, family);
                return 0;
@@ -535,7 +529,6 @@ static struct genl_family genl_ctrl = {
        .name = "nlctrl",
        .version = 0x1,
        .maxattr = CTRL_ATTR_MAX,
        .name = "nlctrl",
        .version = 0x1,
        .maxattr = CTRL_ATTR_MAX,
-       .owner = THIS_MODULE,
 };
 
 static int __init genl_init(void)
 };
 
 static int __init genl_init(void)
index 6fe95acde4fa0b91990e4e5f2ead6fcbed10fa1b..19b3f4022532ac58a77389c52720c0c3282795e1 100644 (file)
@@ -72,7 +72,6 @@ static struct genl_family family = {
         .version       = TIPC_GENL_VERSION,
         .hdrsize       = TIPC_GENL_HDRLEN,
         .maxattr       = 0,
         .version       = TIPC_GENL_VERSION,
         .hdrsize       = TIPC_GENL_HDRLEN,
         .maxattr       = 0,
-       .owner          = THIS_MODULE,
 };
 
 static struct genl_ops ops = {
 };
 
 static struct genl_ops ops = {