* [PATCH] xfrm: Fix error return code in xfrm_output_one()
@ 2018-10-27 6:12 Wei Yongjun
2018-10-30 11:48 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2018-10-27 6:12 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu; +Cc: Wei Yongjun, netdev, kernel-janitors
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>
---
net/xfrm/xfrm_output.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 4ae87c5c..fef6b2d 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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfrm: Fix error return code in xfrm_output_one()
2018-10-27 6:12 [PATCH] xfrm: Fix error return code in xfrm_output_one() Wei Yongjun
@ 2018-10-30 11:48 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2018-10-30 11:48 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Herbert Xu, netdev, kernel-janitors
On Sat, Oct 27, 2018 at 06:12:06AM +0000, Wei Yongjun wrote:
> 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>
Applied, thanks a lot!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-30 20:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-27 6:12 [PATCH] xfrm: Fix error return code in xfrm_output_one() Wei Yongjun
2018-10-30 11:48 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).