xfrm: Fix NULL pointer dereference on policy lookup
authorSteffen Klassert <steffen.klassert@secunet.com>
Tue, 23 Mar 2021 08:26:44 +0000 (09:26 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 24 Mar 2021 09:00:24 +0000 (10:00 +0100)
commitb1e3a5607034aa0a481c6f69a6893049406665fb
tree8283c922b67fbcb204219deaad46456bc87777ad
parent68dc022d04eb0fd60a540e242dcb11ec1bee07e2
xfrm: Fix NULL pointer dereference on policy lookup

When xfrm interfaces are used in combination with namespaces
and ESP offload, we get a dst_entry NULL pointer dereference.
This is because we don't have a dst_entry attached in the ESP
offloading case and we need to do a policy lookup before the
namespace transition.

Fix this by expicit checking of skb_dst(skb) before accessing it.

Fixes: f203b76d78092 ("xfrm: Add virtual xfrm interfaces")
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h