summaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorWei Yongjun2018-10-27 08:12:06 +0200
committerGreg Kroah-Hartman2019-01-13 09:50:57 +0100
commit34a2f36c0115b52c316a10c53472fe6dfc2d17ea (patch)
treef2fd6fb24ad57e15c230a6d3e0cbd25d5ea31285 /net/xfrm
parentcheckstack.pl: fix for aarch64 (diff)
downloadkernel-qcow2-linux-34a2f36c0115b52c316a10c53472fe6dfc2d17ea.tar.gz
kernel-qcow2-linux-34a2f36c0115b52c316a10c53472fe6dfc2d17ea.tar.xz
kernel-qcow2-linux-34a2f36c0115b52c316a10c53472fe6dfc2d17ea.zip
xfrm: Fix error return code in xfrm_output_one()
[ Upstream commit 533555e5cbb6aa2d77598917871ae5b579fe724b ] xfrm_output_one() does not return a error code when there is no dst_entry attached to the skb, it is still possible crash with a NULL pointer dereference in xfrm_output_resume(). Fix it by return error code -EHOSTUNREACH. Fixes: 9e1437937807 ("xfrm: Fix NULL pointer dereference when skb_dst_force clears the dst_entry.") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_output.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 261995d37ced..6d20fbcde000 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -102,6 +102,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
skb_dst_force(skb);
if (!skb_dst(skb)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
+ err = -EHOSTUNREACH;
goto error_nolock;
}