Hi David,

        Please consider pulling from:

rsync://rsync.kernel.org/pub/scm/linux/kernel/git/acme/dccp-2.6.14-rc.git/

Best Regards,

                        - Arnaldo

tree df96ae7b8146da0098e92a761ee8f26790121a60
parent 45c49d2c0ddfa12a9c9ac6c79166fa0a17b3669c
author Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> 1129003853 -0300
committer Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> 1129003853 -0300

[TWSK]: Grab the module refcount for timewait sockets

This is required to avoid unloading a module that has active timewait sockets,
such as DCCP.

Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>

------------------------------------------------------------------------------

 include/net/inet_timewait_sock.h |    3 +++
 net/ipv4/inet_timewait_sock.c    |    1 +
 2 files changed, 4 insertions(+)

------------------------------------------------------------------------------

diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 4ade56e..28f7b21 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -19,6 +19,7 @@
 
 #include <linux/ip.h>
 #include <linux/list.h>
+#include <linux/module.h>
 #include <linux/timer.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
@@ -193,11 +194,13 @@ static inline u32 inet_rcv_saddr(const s
 static inline void inet_twsk_put(struct inet_timewait_sock *tw)
 {
        if (atomic_dec_and_test(&tw->tw_refcnt)) {
+               struct module *owner = tw->tw_prot->owner;
 #ifdef SOCK_REFCNT_DEBUG
                printk(KERN_DEBUG "%s timewait_sock %p released\n",
                       tw->tw_prot->name, tw);
 #endif
                kmem_cache_free(tw->tw_prot->twsk_slab, tw);
+               module_put(owner);
        }
 }
 
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index f9076ef..a010e9a 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -111,6 +111,7 @@ struct inet_timewait_sock *inet_twsk_all
                tw->tw_prot         = sk->sk_prot_creator;
                atomic_set(&tw->tw_refcnt, 1);
                inet_twsk_dead_node_init(tw);
+               __module_get(tw->tw_prot->owner);
        }
 
        return tw;
-
To unsubscribe from this list: send the line "unsubscribe dccp" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to