OSDN Git Service

tipc: buffer overflow handling in listener socket
authorTung Nguyen <tung.q.nguyen@dektech.com.au>
Fri, 28 Sep 2018 18:23:22 +0000 (20:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Sep 2018 18:24:22 +0000 (11:24 -0700)
commit6787927475e52f6933e3affce365dabb2aa2fadf
treebb149221e75bb812ed610f50f993d81c55af9dd8
parent25b9221b959483f17c2964d0922869e16caa86b5
tipc: buffer overflow handling in listener socket

Default socket receive buffer size for a listener socket is 2Mb. For
each arriving empty SYN, the linux kernel allocates a 768 bytes buffer.
This means that a listener socket can serve maximum 2700 simultaneous
empty connection setup requests before it hits a receive buffer
overflow, and much fewer if the SYN is carrying any significant
amount of data.

When this happens the setup request is rejected, and the client
receives an ECONNREFUSED error.

This commit mitigates this problem by letting the client socket try to
retransmit the SYN message multiple times when it sees it rejected with
the code TIPC_ERR_OVERLOAD. Retransmission is done at random intervals
in the range of [100 ms, setup_timeout / 4], as many times as there is
room for within the setup timeout limit.

Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/msg.c
net/tipc/msg.h
net/tipc/socket.c