Skip to content

Commit 33dae81

Browse files
lxingregkh
authored andcommitted
sctp: discard stale INIT after handshake completion
[ Upstream commit 8a92cb4 ] After an association reaches ESTABLISHED, the peer’s init_tag is already known from the handshake. Any subsequent INIT with the same init_tag is not a valid restart, but a delayed or duplicate INIT. Drop such INIT chunks in sctp_sf_do_unexpected_init() instead of processing them as new association attempts. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Link: https://patch.msgid.link/5788c76c1ee122a3ed00189e88dcf9df1fba226c.1777214801.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8f7573f commit 33dae81

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

net/sctp/sm_statefuns.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,12 @@ static enum sctp_disposition sctp_sf_do_unexpected_init(
15561556
/* Tag the variable length parameters. */
15571557
chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr));
15581558

1559+
if (asoc->state >= SCTP_STATE_ESTABLISHED) {
1560+
/* Discard INIT matching peer vtag after handshake completion (stale INIT). */
1561+
if (ntohl(chunk->subh.init_hdr->init_tag) == asoc->peer.i.init_tag)
1562+
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
1563+
}
1564+
15591565
/* Verify the INIT chunk before processing it. */
15601566
err_chunk = NULL;
15611567
if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type,

0 commit comments

Comments
 (0)