summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec/errors.rs
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@kernel.org>2026-10-30 09:12:25 +0100
committerPaolo Abeni <pabeni@redhat.com>2026-11-02 22:00:27 +0100
commit3ae20e4697eb969104fe4b1e98a675f0100382b6 (patch)
treecfa65fee4df6c6f16af03aeadd752b2500ed5a12 /rust/kernel/alloc/kvec/errors.rs
parent7308ef8b4a6779a39f68d053c19b53a5c584a663 (diff)
inet: frags: limit the truesize of a reassembly queue
The truesize of fragments in a reassembly queue is only bounded by the per netns ipfrag_high_thresh sysctl, which has no upper limit. inet_frag_reasm_finish() sums the truesize of all fragments in an int. If this sum reaches 2^32, it wraps, and the final sk_wmem_alloc adjustment of the socket owning the reassembled skb can cancel its own reference, leading to a use-after-free of this socket. This can be triggered from an unprivileged user/network namespace, raising ipfrag_high_thresh and using padded TUN packets, which keep a large truesize after being trimmed by ip_rcv_core(). Track the sum of the truesize of fragments in each queue, and refuse a fragment that would make it bigger than INT_MAX / 2. Callers kill the queue on this error. This bound is far above the needs of legitimate traffic. Fixes: 18685451fc4e ("inet: inet_defrag: prevent sk release while still in use") Cc: stable@vger.kernel.org Reported-by: Kyle Zeng <kylebot@openai.com> Cc: Florian Westphal <fw@strlen.de> Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev> Tested-by: Wang Zhan <wang.zhan@smartx.com> Link: https://patch.msgid.link/20261030081225.2575462-1-edumazet@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions