summaryrefslogtreecommitdiff
path: root/net/mptcp/protocol.c
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2021-01-25 11:08:34 +0900
committerStafford Horne <shorne@gmail.com>2021-01-25 11:16:06 +0900
commit2261352157a932717ec08b9dd18d1bfbb7c37c52 (patch)
treeb48a3ea4060a7d078aecb97de07597a8eb24467a /net/mptcp/protocol.c
parent3706f9f76a4f79f8e7b2eb8b99877e89fe9ad732 (diff)
parent031c7a8cd6fc565e90320bf08f22ee6e70f9d969 (diff)
Merge remote-tracking branch 'openrisc/or1k-5.11-fixes' into or1k-5.12-updates
Pickup fixes that went upstream already in order to resolve conflicts in litex_soc_ctrl.c between 5.11 fixes that went upstream and the or1k-5.12-updates linux-next queue. Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'net/mptcp/protocol.c')
-rw-r--r--net/mptcp/protocol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 09b19aa2f205..6628d8d74203 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -877,6 +877,9 @@ static void __mptcp_wmem_reserve(struct sock *sk, int size)
struct mptcp_sock *msk = mptcp_sk(sk);
WARN_ON_ONCE(msk->wmem_reserved);
+ if (WARN_ON_ONCE(amount < 0))
+ amount = 0;
+
if (amount <= sk->sk_forward_alloc)
goto reserve;
@@ -1587,7 +1590,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
return -EOPNOTSUPP;
- mptcp_lock_sock(sk, __mptcp_wmem_reserve(sk, len));
+ mptcp_lock_sock(sk, __mptcp_wmem_reserve(sk, min_t(size_t, 1 << 20, len)));
timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);