]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:47:17 +0000 (08:47 +0200)
commitffbb80ef6d082f8f857fecbc45d1ac3d7447ee96
treeb718f4ff6a0efea2ec7380815d14a8fe564f8659
parentf769063baf06d962c9d2406ba41ab1e7fac9acc1
xfrm: Fix NULL pointer dereference on policy lookup

[ Upstream commit b1e3a5607034aa0a481c6f69a6893049406665fb ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/xfrm.h