* [PATCH] mptcp: reject negative MPTCP_INFO lengths
@ 2026-12-05 5:42 Shawn Shao
2026-12-05 5:48 ` netdev-bot+sinfo
2026-12-05 6:48 ` Matthieu Baerts
0 siblings, 2 replies; 3+ messages in thread
From: Shawn Shao @ 2026-12-05 5:42 UTC (permalink / raw)
To: matttbe, martineau
Cc: geliang, davem, edumazet, kuba, pabeni, willemb, horms, netdev,
mptcp
mptcp_getsockopt_info() reads optlen as a signed int but converts it to
unsigned int in min_t(). A negative value therefore selects the full
MPTCP_INFO structure instead of being rejected.
Reject negative lengths before the zero-length check and unsigned
conversion.
Tested on x86_64 with QEMU TCG. Negative lengths return -EINVAL without
changing optlen or the output buffer; nonnegative length controls pass.
Link: https://gist.github.com/shaos26/a719048f273e0e3bd14b1fb9feee1e4a
Fixes: 55c42fa7fa33 ("mptcp: add MPTCP_INFO getsockopt")
Signed-off-by: Shawn Shao <shawnq1@163.com>
---
net/mptcp/sockopt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index fcf6feb2a9eb5..84d9ce2a9ba81 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -1038,6 +1038,8 @@ static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, in
if (get_user(len, optlen))
return -EFAULT;
+ if (len < 0)
+ return -EINVAL;
/* When used only to check if a fallback to TCP happened. */
if (len == 0)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mptcp: reject negative MPTCP_INFO lengths
2026-12-05 5:42 [PATCH] mptcp: reject negative MPTCP_INFO lengths Shawn Shao
@ 2026-12-05 5:48 ` netdev-bot+sinfo
2026-12-05 6:48 ` Matthieu Baerts
1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-12-05 5:48 UTC (permalink / raw)
To: Shawn Shao
Cc: matttbe, martineau, geliang, davem, edumazet, kuba, pabeni,
willemb, horms, netdev, mptcp
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mptcp: reject negative MPTCP_INFO lengths
2026-12-05 5:42 [PATCH] mptcp: reject negative MPTCP_INFO lengths Shawn Shao
2026-12-05 5:48 ` netdev-bot+sinfo
@ 2026-12-05 6:48 ` Matthieu Baerts
1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2026-12-05 6:48 UTC (permalink / raw)
To: Shawn Shao
Cc: martineau, geliang, davem, edumazet, kuba, pabeni, willemb, horms,
netdev, mptcp
Hi Shawn,
05 Dec 2026 06:43:09 Shawn Shao <shawnq1@163.com>:
>
> mptcp_getsockopt_info() reads optlen as a signed int but converts it to
> unsigned int in min_t(). A negative value therefore selects the full
> MPTCP_INFO structure instead of being rejected.
>
> Reject negative lengths before the zero-length check and unsigned
> conversion.
Thanks!
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
While at it:
Cc: stable@vger.kernel.org
Cheers,
Matt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-05 6:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 5:42 [PATCH] mptcp: reject negative MPTCP_INFO lengths Shawn Shao
2026-12-05 5:48 ` netdev-bot+sinfo
2026-12-05 6:48 ` Matthieu Baerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox