summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2026-11-03 13:20:10 +0100
committerPaolo Abeni <pabeni@redhat.com>2026-11-03 13:20:11 +0100
commitb3427f41f831adecc8ffd89afc9d30c279115658 (patch)
treef1d2e9533c991c70849d5d573f42b0a69ac9392f /include
parent03d36763291edfb285f08185f4ffda83360ba7ee (diff)
parent5def91015ba7b59de62a81384572da7281b8a033 (diff)
Merge tag 'ipsec-2026-11-02' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec
Steffen Klassert says: ==================== pull request (net): ipsec 2026-11-02 1) xfrm: retry inexact policy lookup after node reinsertion Detect a concurrent change of the inexact policy tree while it is searched and retry the lookup, so an insertion can't make it return the wrong policy. 2) xfrm: interface: validate the IP header on xmit Validate the IP header in xfrmi_xmit() like the IP receive path does, so packets injected into an xfrm interface can't reach the output path with a malformed header. 3) xfrm: zero-initialise km_event in the replay-notify path Zero-initialise the replay event so the netlink header of a kernel-originated replay notification no longer carries uninitialised stack values. 4) xfrm: espintcp: reorder operations within espintcp_init_sk Publish the ESP-in-TCP context before installing the socket callbacks, so an early callback can't dereference a context that isn't set up yet. 5) xfrm: state: reject mark with bits outside its mask on add Reject a mark with bits outside its mask on state insert instead of silently truncating it, so a lookup can't be given a mark that never matches. 6) xfrm: state: reject mark with bits outside its mask on ALLOCSPI Apply the same mark validation to ALLOCSPI, keeping the state and policy insert paths consistent. 7) xfrm: policy: reject mark with bits outside its mask on add Apply the same mark validation to policy insert, so a policy can't be stored with a mark that never matches. 8) xfrm: state: exact mark/mask match for SPI-keyed control-plane SA lookups Match mark and mask exactly in the SPI-keyed netlink SA lookups, so a catch-all SA can no longer shadow a more specific one. 9) xfrm: fix use-after-free of migrated state in xfrm_do_migrate_state() Hold the cloned state for the whole migration, so a concurrent delete can't free it while it is still in use. 10) xfrm: fix hw offload state leak on xfrm_do_migrate_state() error path Remove the hardware offload of the cloned state on the migration error path, so the offloaded SA entry isn't leaked. 11) xfrm: include mark in MIGRATE_STATE SA collision check Include the mark in the SA collision check, so a migration that only changes the mark can't install a duplicate SA tuple. 12) xfrm: pass extack through to xfrm_init_replay() from xfrm_init_state() Pass the extack to xfrm_init_replay(), so replay window errors can be reported to userspace. 13) docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple Document the mark as part of the EEXIST tuple of the SA migration request. 14) xfrm4: use a full socket for local errors Resolve the socket owner with skb_to_full_sk() in the IPv4 local error path, so a TCP request socket isn't used as a full socket. Please pull or let me know if there are problems. ipsec-2026-11-02 * tag 'ipsec-2026-11-02' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec: xfrm4: use a full socket for local errors docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple xfrm: pass extack through to xfrm_init_replay() from xfrm_init_state() xfrm: include mark in MIGRATE_STATE SA collision check xfrm: fix hw offload state leak on xfrm_do_migrate_state() error path xfrm: fix use-after-free of migrated state in xfrm_do_migrate_state() xfrm: state: exact mark/mask match for SPI-keyed control-plane SA lookups xfrm: policy: reject mark with bits outside its mask on add xfrm: state: reject mark with bits outside its mask on ALLOCSPI xfrm: state: reject mark with bits outside its mask on add xfrm: espintcp: reorder operations within espintcp_init_sk xfrm: zero-initialise km_event in the replay-notify path xfrm: interface: validate the IP header on xmit xfrm: retry inexact policy lookup after node reinsertion ==================== Link: https://patch.msgid.link/20261102100451.2505200-1-steffen.klassert@secunet.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/espintcp.h5
-rw-r--r--include/net/xfrm.h7
2 files changed, 10 insertions, 2 deletions
diff --git a/include/net/espintcp.h b/include/net/espintcp.h
index c70efd704b6d..7cad3c6822df 100644
--- a/include/net/espintcp.h
+++ b/include/net/espintcp.h
@@ -34,7 +34,8 @@ static inline struct espintcp_ctx *espintcp_getctx(const struct sock *sk)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
- /* RCU is only needed for diag */
- return (__force void *)icsk->icsk_ulp_data;
+ /* pairs with smp_wmb() in espintcp_init_sk() */
+ smp_rmb();
+ return (__force void *)READ_ONCE(icsk->icsk_ulp_data);
}
#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 298ca9bb0083..445223a8dc6f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1765,6 +1765,13 @@ struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
const xfrm_address_t *saddr,
u8 proto,
unsigned short family);
+struct xfrm_state *xfrm_state_lookup_exact(struct net *net, const struct xfrm_mark *mark,
+ const xfrm_address_t *daddr, __be32 spi,
+ u8 proto, unsigned short family);
+bool xfrm_state_mark_collides(struct net *net, u32 mark,
+ const xfrm_address_t *daddr, __be32 spi,
+ u8 proto, unsigned short family,
+ const struct xfrm_state *self);
#ifdef CONFIG_XFRM_SUB_POLICY
void xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
unsigned short family);