Patch "sctp: fix a potential overflow in sctp_ifwdtsn_skip" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sctp: fix a potential overflow in sctp_ifwdtsn_skip

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sctp-fix-a-potential-overflow-in-sctp_ifwdtsn_skip.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b933019e02d305c40ff66debc1620f41b2b64600
Author: Xin Long <lucien.xin@xxxxxxxxx>
Date:   Mon Apr 10 15:43:30 2023 -0400

    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: 0fc2ea922c8a ("sctp: implement validate_ftsn for sctp_stream_interleave")
    Signed-off-by: Xin Long <lucien.xin@xxxxxxxxx>
    Link: https://lore.kernel.org/r/2a71bffcd80b4f2c61fac6d344bb2f11c8fd74f7.1681155810.git.lucien.xin@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
index 6b13f737ebf2e..e3aad75cb11d9 100644
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1162,7 +1162,8 @@ static void sctp_generate_iftsn(struct sctp_outq *q, __u32 ctsn)
 
 #define _sctp_walk_ifwdtsn(pos, chunk, end) \
 	for (pos = chunk->subh.ifwdtsn_hdr->skip; \
-	     (void *)pos < (void *)chunk->subh.ifwdtsn_hdr->skip + (end); pos++)
+	     (void *)pos <= (void *)chunk->subh.ifwdtsn_hdr->skip + (end) - \
+			    sizeof(struct sctp_ifwdtsn_skip); pos++)
 
 #define sctp_walk_ifwdtsn(pos, ch) \
 	_sctp_walk_ifwdtsn((pos), (ch), ntohs((ch)->chunk_hdr->length) - \



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux