aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>2017-01-24 07:00:47 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-24 16:14:58 -0500
commit4c887aa65d38633885010277f3482400681be719 (patch)
tree8fb8f5a432aee0221919bc347bbbaef9df4fadeb /net/tipc
parent9dc3abdd1f7ea524e8552e0a3ef01219892ed1f4 (diff)
tipc: ignore requests when the connection state is not CONNECTED
In tipc_conn_sendmsg(), we first queue the request to the outqueue followed by the connection state check. If the connection is not connected, we should not queue this message. In this commit, we reject the messages if the connection state is not CF_CONNECTED. Acked-by: Ying Xue <ying.xue@windriver.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Tested-by: John Thompson <thompa.atl@gmail.com> Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/server.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/tipc/server.c b/net/tipc/server.c
index 826cde2c401e..04ff441b8065 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -453,6 +453,11 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid,
453 if (!con) 453 if (!con)
454 return -EINVAL; 454 return -EINVAL;
455 455
456 if (!test_bit(CF_CONNECTED, &con->flags)) {
457 conn_put(con);
458 return 0;
459 }
460
456 e = tipc_alloc_entry(data, len); 461 e = tipc_alloc_entry(data, len);
457 if (!e) { 462 if (!e) {
458 conn_put(con); 463 conn_put(con);
@@ -466,12 +471,8 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid,
466 list_add_tail(&e->list, &con->outqueue); 471 list_add_tail(&e->list, &con->outqueue);
467 spin_unlock_bh(&con->outqueue_lock); 472 spin_unlock_bh(&con->outqueue_lock);
468 473
469 if (test_bit(CF_CONNECTED, &con->flags)) { 474 if (!queue_work(s->send_wq, &con->swork))
470 if (!queue_work(s->send_wq, &con->swork))
471 conn_put(con);
472 } else {
473 conn_put(con); 475 conn_put(con);
474 }
475 return 0; 476 return 0;
476} 477}
477 478
@@ -495,7 +496,7 @@ static void tipc_send_to_sock(struct tipc_conn *con)
495 int ret; 496 int ret;
496 497
497 spin_lock_bh(&con->outqueue_lock); 498 spin_lock_bh(&con->outqueue_lock);
498 while (1) { 499 while (test_bit(CF_CONNECTED, &con->flags)) {
499 e = list_entry(con->outqueue.next, struct outqueue_entry, 500 e = list_entry(con->outqueue.next, struct outqueue_entry,
500 list); 501 list);
501 if ((struct list_head *) e == &con->outqueue) 502 if ((struct list_head *) e == &con->outqueue)