From: Nicolas Dichtel Date: Mon, 22 Nov 2021 10:33:13 +0000 (+0100) Subject: xfrm: fix dflt policy check when there is no policy configured X-Git-Tag: accepted/tizen/unified/20230118.172025~3008 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c1154f395cb4c24996829b0dfafa78754702729;p=platform%2Fkernel%2Flinux-rpi.git xfrm: fix dflt policy check when there is no policy configured commit ec3bb890817e4398f2d46e12e2e205495b116be9 upstream. When there is no policy configured on the system, the default policy is checked in xfrm_route_forward. However, it was done with the wrong direction (XFRM_POLICY_FWD instead of XFRM_POLICY_OUT). The default policy for XFRM_POLICY_FWD was checked just before, with a call to xfrm[46]_policy_check(). CC: stable@vger.kernel.org Fixes: 2d151d39073a ("xfrm: Add possibility to set the default to block if we have no policy") Signed-off-by: Nicolas Dichtel Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 2589e4c..2b1ce85 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1167,7 +1167,7 @@ static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) { struct net *net = dev_net(skb->dev); - if (xfrm_default_allow(net, XFRM_POLICY_FWD)) + if (xfrm_default_allow(net, XFRM_POLICY_OUT)) return !net->xfrm.policy_count[XFRM_POLICY_OUT] || (skb_dst(skb)->flags & DST_NOXFRM) || __xfrm_route_forward(skb, family);