]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
sctp: fix the processing for INIT_ACK chunk
authorXin Long <lucien.xin@gmail.com>
Wed, 20 Oct 2021 11:42:43 +0000 (07:42 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 24 Nov 2021 11:09:24 +0000 (12:09 +0100)
commite782ed661cd3f31c2876458804300d9b686c1ea3
tree8ab4867e97c90d55d78fd27cd50ee0fe2bde0d03
parent60ec9c7aabc9f9b7e530eb088b52373ee5d27ae2
sctp: fix the processing for INIT_ACK chunk

BugLink: https://bugs.launchpad.net/bugs/1951883
[ Upstream commit 438b95a7c98f77d51cbf4db021f41b602d750a3f ]

Currently INIT_ACK chunk in non-cookie_echoed state is processed in
sctp_sf_discard_chunk() to send an abort with the existent asoc's
vtag if the chunk length is not valid. But the vtag in the chunk's
sctphdr is not verified, which may be exploited by one to cook a
malicious chunk to terminal a SCTP asoc.

sctp_sf_discard_chunk() also is called in many other places to send
an abort, and most of those have this problem. This patch is to fix
it by sending abort with the existent asoc's vtag only if the vtag
from the chunk's sctphdr is verified in sctp_sf_discard_chunk().

Note on sctp_sf_do_9_1_abort() and sctp_sf_shutdown_pending_abort(),
the chunk length has been verified before sctp_sf_discard_chunk(),
so replace it with sctp_sf_discard(). On sctp_sf_do_asconf_ack() and
sctp_sf_do_asconf(), move the sctp_chunk_length_valid check ahead of
sctp_sf_discard_chunk(), then replace it with sctp_sf_discard().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/sctp/sm_statefuns.c