diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-03-06 08:40:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-06 14:46:23 -0500 |
commit | 4652edb70e8a7eebbe47fa931940f65522c36e8f (patch) | |
tree | 9e8da88878a1ec493a552cce5d59ecf0399499d9 /net | |
parent | 6d4ebeb4df0176b1973875840a9f7e91394c0685 (diff) |
tipc: fix connection refcount leak
When tipc_conn_sendmsg() calls tipc_conn_lookup() to query a
connection instance, its reference count value is increased if
it's found. But subsequently if it's found that the connection is
closed, the work of sending message is not queued into its server
send workqueue, and the connection reference count is not decreased.
This will cause a reference count leak. To reproduce this problem,
an application would need to open and closes topology server
connections with high intensity.
We fix this by immediately decrementing the connection reference
count if a send fails due to the connection being closed.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/tipc/server.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/tipc/server.c b/net/tipc/server.c index bbaa8f56024a..646a930eefbf 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
@@ -427,10 +427,12 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid, | |||
427 | list_add_tail(&e->list, &con->outqueue); | 427 | list_add_tail(&e->list, &con->outqueue); |
428 | spin_unlock_bh(&con->outqueue_lock); | 428 | spin_unlock_bh(&con->outqueue_lock); |
429 | 429 | ||
430 | if (test_bit(CF_CONNECTED, &con->flags)) | 430 | if (test_bit(CF_CONNECTED, &con->flags)) { |
431 | if (!queue_work(s->send_wq, &con->swork)) | 431 | if (!queue_work(s->send_wq, &con->swork)) |
432 | conn_put(con); | 432 | conn_put(con); |
433 | 433 | } else { | |
434 | conn_put(con); | ||
435 | } | ||
434 | return 0; | 436 | return 0; |
435 | } | 437 | } |
436 | 438 | ||