summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2017-05-03 16:43:19 +0200
committerSasha Levin <alexander.levin@verizon.com>2017-07-31 13:37:51 -0400
commit0e6595717cef0eceabd1ac0daf7009b9286cf4fa (patch)
tree0c6130ffe8e46ac01da87844952d1d12db3768d4 /include/net
parent140c49cf22a9d93aa25abea933e3486ac609723a (diff)
xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY
[ Upstream commit 9b3eb54106cf6acd03f07cf0ab01c13676a226c2 ] When CONFIG_XFRM_SUB_POLICY=y, xfrm_dst stores a copy of the flowi for that dst. Unfortunately, the code that allocates and fills this copy doesn't care about what type of flowi (flowi, flowi4, flowi6) gets passed. In multiple code paths (from raw_sendmsg, from TCP when replying to a FIN, in vxlan, geneve, and gre), the flowi that gets passed to xfrm is actually an on-stack flowi4, so we end up reading stuff from the stack past the end of the flowi4 struct. Since xfrm_dst->origin isn't used anywhere following commit ca116922afa8 ("xfrm: Eliminate "fl" and "pol" args to xfrm_bundle_ok()."), just get rid of it. xfrm_dst->partner isn't used either, so get rid of that too. Fixes: 9d6ec938019c ("ipv4: Use flowi4 in public route lookup interfaces.") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/xfrm.h10
1 files changed, 0 insertions, 10 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 36ac102c97c7..3dac7ac61f48 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -945,10 +945,6 @@ struct xfrm_dst {
struct flow_cache_object flo;
struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
int num_pols, num_xfrms;
-#ifdef CONFIG_XFRM_SUB_POLICY
- struct flowi *origin;
- struct xfrm_selector *partner;
-#endif
u32 xfrm_genid;
u32 policy_genid;
u32 route_mtu_cached;
@@ -964,12 +960,6 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
dst_release(xdst->route);
if (likely(xdst->u.dst.xfrm))
xfrm_state_put(xdst->u.dst.xfrm);
-#ifdef CONFIG_XFRM_SUB_POLICY
- kfree(xdst->origin);
- xdst->origin = NULL;
- kfree(xdst->partner);
- xdst->partner = NULL;
-#endif
}
#endif