History

tipc: close the connection if protocol messages contain errors

When a socket is shutting down, we notify the peer node about the connection termination by reusing an incoming message if possible. If the last received message was a connection acknowledgment message, we reverse this message and set the error code to TIPC_ERR_NO_PORT and send it to peer. In tipc_sk_proto_rcv(), we never check for message errors while processing the connection acknowledgment or probe messages. Thus this message performs the usual flow control accounting and leaves the session hanging. In this commit, we terminate the connection when we receive such error messages.

Parthasarathy Bhuvaragan committed 9 years ago

Commit c1be7751 parent 4e0df491 file · +8 −0Browse files

Unified · Split

net/tipc/socket.c+8−0
@@ -866,6 +866,14 @@ static void tipc_sk_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb, · 865 unmodified lines
866866 if (!tsk_peer_msg(tsk, hdr))
867867 goto exit;
868868
869+ if (unlikely(msg_errcode(hdr))) {
870+ tipc_set_sk_state(sk, TIPC_DISCONNECTING);
871+ tipc_node_remove_conn(sock_net(sk), tsk_peer_node(tsk),
872+ tsk_peer_port(tsk));
873+ sk->sk_state_change(sk);
874+ goto exit;
875+ }
876+
869877 tsk->probe_unacked = false;
870878
871879 if (mtyp == CONN_PROBE) {