OSDN Git Service

xfrm: Don't use sk_family for socket policy lookups
authorSteffen Klassert <steffen.klassert@secunet.com>
Tue, 14 Feb 2017 06:43:56 +0000 (07:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Aug 2017 02:19:46 +0000 (19:19 -0700)
commitce9b76665ecdd7c292f460176b3e183b37263b74
treee5db6fa0734db98ee98f4aebf7ebfd64e7be5ab0
parent4b8adea2e3cd49d81fc5a45f7b10fc4f0a248187
xfrm: Don't use sk_family for socket policy lookups

commit 4c86d77743a54fb2d8a4d18a037a074c892bb3be upstream.

On IPv4-mapped IPv6 addresses sk_family is AF_INET6,
but the flow informations are created based on AF_INET.
So the routing set up 'struct flowi4' but we try to
access 'struct flowi6' what leads to an out of bounds
access. Fix this by using the family we get with the
dst_entry, like we do it for the standard policy lookup.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/xfrm/xfrm_policy.c