summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@kernel.org>2026-11-04 16:03:18 +0100
committerJakub Kicinski <kuba@kernel.org>2026-11-06 14:44:44 -0800
commitb4a2cc6d748d3056a25812dcf5f5377a59afd02f (patch)
tree32867cb2d6e778e2f4ff1a38a6924df4f1c90835 /rust/kernel/alloc/kvec
parent9c1adbe7fa6cbc02c25db2039532918acf846400 (diff)
calipso: do not charge request socket options to the listener
calipso_req_setattr() and calipso_req_delattr() allocate ireq->ipv6_opt with ipv6_renew_options(), which charges the listener sk_omem_alloc through sock_kmalloc(). tcp_v6_reqsk_destructor() frees ireq->ipv6_opt without uncharging it, so each request socket leaks its options size from the listener budget. Once sysctl_optmem_max is reached, sock_kmalloc() fails, calipso_req_setattr() returns -ENOBUFS, and tcp_v6_route_req() drops all subsequent SYN packets. __sk_destruct() also reports an optmem leakage when the listener is destroyed. Uncharging in tcp_v6_reqsk_destructor() would not be correct: after a migration, req->rsk_listener is no longer the socket that was charged. These options belong to the request socket, there is no reason to charge them to the listener. Change ipv6_renew_options() to use kmalloc() when its sk argument is NULL, and use this from calipso_req_setattr() and calipso_req_delattr(), like cipso_v4_req_setattr() which uses kzalloc(). Note: After this patch, calipso_req_setattr() and calipso_req_delattr() no longer need the listener. Commit 10876da918fa ("calipso: Fix null-ptr-deref in calipso_req_{set,del}attr().") could be reverted in net-next (also removing the then unused sk variables), so that CALIPSO works with SYN cookies. Fixes: e1adea927080 ("calipso: Allow request sockets to be relabelled by the lsm.") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/netdev/179378292255.488856.6917577451813010963@kernel.org/ Signed-off-by: Eric Dumazet <edumazet@kernel.org> Cc: Kuniyuki Iwashima <kuniyu@google.com> Cc: Paul Moore <paul@paul-moore.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Acked-by: Paul Moore <paul@paul-moore.com> Link: https://patch.msgid.link/20261104150318.1156620-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/kvec')
0 files changed, 0 insertions, 0 deletions