diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-26 12:55:17 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-26 12:55:17 +0200 |
commit | 71e69d7adee10a55b817df748dec5bfec7bf4c30 (patch) | |
tree | ac342851e20df5a5f7891cc603998b654d26724c /net/sctp/socket.c | |
parent | 03b1292d1c0ea195e025e667555d74db7da82026 (diff) | |
parent | ff1176468d368232b684f75e82563369208bc371 (diff) |
Merge 5.14-rc3 into char-misc-next
We need the char-misc fixes from 5.14-rc3 into here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e64e01f61b11..6b937bfd4751 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -4577,6 +4577,10 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, } if (optlen > 0) { + /* Trim it to the biggest size sctp sockopt may need if necessary */ + optlen = min_t(unsigned int, optlen, + PAGE_ALIGN(USHRT_MAX + + sizeof(__u16) * sizeof(struct sctp_reset_streams))); kopt = memdup_sockptr(optval, optlen); if (IS_ERR(kopt)) return PTR_ERR(kopt); |