]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 3 May 2017 14:43:19 +0000 (16:43 +0200)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Mon, 2 Oct 2017 19:36:05 +0000 (12:36 -0700)
commitce89aedb5cd287f37fb40ae0c510a14ab5eea5fe
treeccebcb5d04686076c88013b88feebbb5b808cef7
parent70d300d0273d1f4505698dedcbaedec7dfa371f6
xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY

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>
(cherry picked from commit 9b3eb54106cf6acd03f07cf0ab01c13676a226c2)

Orabug: 25959303

Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
include/net/xfrm.h
net/xfrm/xfrm_policy.c