]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/tipc/port.c
[IPV6]: Fixed the size of the netlink message notified by inet6_rt_notify().
[linux-2.6-omap-h63xx.git] / net / tipc / port.c
index 3251c8d8e53c3bcc401a13e53d6636d410b6b5d0..b7f3199523caaf846d0aa1479c69888426374040 100644 (file)
@@ -226,12 +226,11 @@ u32 tipc_createport_raw(void *usr_handle,
        struct tipc_msg *msg;
        u32 ref;
 
-       p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC);
+       p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC);
        if (!p_ptr) {
                warn("Port creation failed, no memory\n");
                return 0;
        }
-       memset(p_ptr, 0, sizeof(*p_ptr));
        ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
        if (!ref) {
                warn("Port creation failed, reference table exhausted\n");
@@ -506,8 +505,13 @@ static void port_timeout(unsigned long ref)
        struct port *p_ptr = tipc_port_lock(ref);
        struct sk_buff *buf = NULL;
 
-       if (!p_ptr || !p_ptr->publ.connected)
+       if (!p_ptr)
+               return;
+
+       if (!p_ptr->publ.connected) {
+               tipc_port_unlock(p_ptr);
                return;
+       }
 
        /* Last probe answered ? */
        if (p_ptr->probing_state == PROBING) {
@@ -1058,7 +1062,7 @@ int tipc_createport(u32 user_ref,
        struct port *p_ptr; 
        u32 ref;
 
-       up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
+       up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
        if (!up_ptr) {
                warn("Port creation failed, no memory\n");
                return -ENOMEM;
@@ -1132,11 +1136,12 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
        int res = -EINVAL;
 
        p_ptr = tipc_port_lock(ref);
+       if (!p_ptr)
+               return -EINVAL;
+
        dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, "
            "lower = %u, upper = %u\n",
            ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper);
-       if (!p_ptr)
-               return -EINVAL;
        if (p_ptr->publ.connected)
                goto exit;
        if (seq->lower > seq->upper)