Patch "sctp: make sure stream nums can match optlen in sctp_setsockopt_reset_streams" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
sctp: make sure stream nums can match optlen in sctp_setsockopt_reset_streams
to the 4.14-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-make-sure-stream-nums-can-match-optlen-in-sctp_setsockopt_reset_streams.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Sun Dec 31 11:12:48 CET 2017
From: Xin Long <[email protected]>
Date: Sun, 10 Dec 2017 15:40:51 +0800
Subject: sctp: make sure stream nums can match optlen in sctp_setsockopt_reset_streams
From: Xin Long <[email protected]>
[ Upstream commit 2342b8d95bcae5946e1b9b8d58645f37500ef2e7 ]
Now in sctp_setsockopt_reset_streams, it only does the check optlen < sizeof(*params) for optlen. But it's not enough, as params->srs_number_streams should also match optlen.
If the streams in params->srs_stream_list are less than stream nums in params->srs_number_streams, later when dereferencing the stream list, it could cause a slab-out-of-bounds crash, as reported by syzbot.
This patch is to fix it by also checking the stream numbers in sctp_setsockopt_reset_streams to make sure at least it's not greater than the streams in the list.
--- net/sctp/socket.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sctp/socket.c +5 -1
@@ -3874,13 +3874,17 @@ static int sctp_setsockopt_reset_streamsstruct sctp_association *asoc;int retval = -EINVAL ; -if (optlen <sizeof (struct sctp_reset_streams )) +if (optlen <sizeof (*params))return -EINVAL ; params =memdup_user (optval, optlen);if (IS_ERR (params))return PTR_ERR (params); +if (params->srs_number_streams *sizeof (__u16) > + optlen -sizeof (*params)) + goto out; + asoc =sctp_id2assoc (sk, params->srs_assoc_id);if (!asoc) goto out;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/sctp-make-sure-stream-nums-can-match-optlen-in-sctp_setsockopt_reset_streams.patch queue-4.14/ipv6-mcast-better-catch-silly-mtu-values.patch