tipc: fix connection refcount leak
[firefly-linux-kernel-4.4.55.git] / net / tipc / server.c
index bbaa8f56024a5d13de1df0ac8032849449c42c0d..646a930eefbf8fa9a86cfe7011848143aafa49b8 100644 (file)
@@ -427,10 +427,12 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid,
        list_add_tail(&e->list, &con->outqueue);
        spin_unlock_bh(&con->outqueue_lock);
 
-       if (test_bit(CF_CONNECTED, &con->flags))
+       if (test_bit(CF_CONNECTED, &con->flags)) {
                if (!queue_work(s->send_wq, &con->swork))
                        conn_put(con);
-
+       } else {
+               conn_put(con);
+       }
        return 0;
 }