]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: fix a potential overflow in sctp_ifwdtsn_skip
authorXin Long <lucien.xin@gmail.com>
Mon, 10 Apr 2023 19:43:30 +0000 (15:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:07:36 +0000 (12:07 +0200)
commit92a8ce69edaa50d169ef1eca014062cea45aec2d
tree1e26bf485e186827ed52f522412f7850d633bf1d
parent862f437b7a32151378583f26eeec81e05742c261
sctp: fix a potential overflow in sctp_ifwdtsn_skip

[ Upstream commit 32832a2caf82663870126c5186cf8f86c8b2a649 ]

Currently, when traversing ifwdtsn skips with _sctp_walk_ifwdtsn, it only
checks the pos against the end of the chunk. However, the data left for
the last pos may be < sizeof(struct sctp_ifwdtsn_skip), and dereference
it as struct sctp_ifwdtsn_skip may cause coverflow.

This patch fixes it by checking the pos against "the end of the chunk -
sizeof(struct sctp_ifwdtsn_skip)" in sctp_ifwdtsn_skip, similar to
sctp_fwdtsn_skip.

Fixes: 588a5a0766aa ("sctp: implement validate_ftsn for sctp_stream_interleave")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Link: https://lore.kernel.org/r/2a71bffcd80b4f2c61fac6d344bb2f11c8fd74f7.1681155810.git.lucien.xin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sctp/stream_interleave.c