From: Wei Yongjun Date: Sat, 27 Oct 2018 06:12:06 +0000 (+0000) Subject: xfrm: Fix error return code in xfrm_output_one() X-Git-Tag: v4.14.93~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf2b044bc820cf1d6fa74ff77b09c33886a01568;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index c47660fba498..b226b230e8bf 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c @@ -103,6 +103,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; }