]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
xfrm: Fix error return code in xfrm_output_one()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 27 Oct 2018 06:12:06 +0000 (06:12 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837477
[ 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>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/xfrm/xfrm_output.c

index c47660fba4988b4d5193928acd5f5879f3fe82d5..b226b230e8bf76bed2de0948353684b94ad237c3 100644 (file)
@@ -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;
                }