On 01/11/2017 08:19 PM, Parthasarathy Bhuvaragan wrote: > 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. > > Signed-off-by: Parthasarathy Bhuvaragan > <parthasarathy.bhuvara...@ericsson.com>
Acked-by: Ying Xue <ying....@windriver.com> I curious what will happen if we don't make the change. > --- > net/tipc/server.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/net/tipc/server.c b/net/tipc/server.c > index e206b8fb826f..fa54a2760ee0 100644 > --- a/net/tipc/server.c > +++ b/net/tipc/server.c > @@ -451,6 +451,11 @@ int tipc_conn_sendmsg(struct tipc_server *s, int conid, > if (!con) > return -EINVAL; > > + if (!test_bit(CF_CONNECTED, &con->flags)) { > + conn_put(con); > + return 0; > + } > + > e = tipc_alloc_entry(data, len); > if (!e) { > conn_put(con); > @@ -464,12 +469,8 @@ 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 (!queue_work(s->send_wq, &con->swork)) > - conn_put(con); > - } else { > + if (!queue_work(s->send_wq, &con->swork)) > conn_put(con); > - } > return 0; > } > > @@ -493,7 +494,7 @@ static void tipc_send_to_sock(struct tipc_conn *con) > int ret; > > spin_lock_bh(&con->outqueue_lock); > - while (1) { > + while (test_bit(CF_CONNECTED, &con->flags)) { > e = list_entry(con->outqueue.next, struct outqueue_entry, > list); > if ((struct list_head *) e == &con->outqueue) > ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ tipc-discussion mailing list tipc-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tipc-discussion