summaryrefslogtreecommitdiff
path: root/net/netrom
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2021-07-17 17:19:19 -0400
committerDavid S. Miller <davem@davemloft.net>2021-07-18 09:47:29 -0700
commit2f3fdd8d4805015fa964807e1c7f3d88f31bd389 (patch)
tree9327d196065b7c7164ad6aefb4c229b12b881ec2 /net/netrom
parentf5051bcece50140abd1a11a2d36dc3ec5484fc32 (diff)
sctp: trim optlen when it's a huge value in sctp_setsockopt
After commit ca84bd058dae ("sctp: copy the optval from user space in sctp_setsockopt"), it does memory allocation in sctp_setsockopt with the optlen, and it would fail the allocation and return error if the optlen from user space is a huge value. This breaks some sockopts, like SCTP_HMAC_IDENT, SCTP_RESET_STREAMS and SCTP_AUTH_KEY, as when processing these sockopts before, optlen would be trimmed to a biggest value it needs when optlen is a huge value, instead of failing the allocation and returning error. This patch is to fix the allocation failure when it's a huge optlen from user space by trimming it to the biggest size sctp sockopt may need when necessary, and this biggest size is from sctp_setsockopt_reset_streams() for SCTP_RESET_STREAMS, which is bigger than those for SCTP_HMAC_IDENT and SCTP_AUTH_KEY. Fixes: ca84bd058dae ("sctp: copy the optval from user space in sctp_setsockopt") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netrom')
0 files changed, 0 insertions, 0 deletions