Message ID | 20250311141238.19862-6-justin.iurman@uliege.be (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: fix lwtunnel reentry loops | expand |
On 3/11/25 3:12 PM, Justin Iurman wrote: > diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c > index 7d574f5132e2..67f7c7015693 100644 > --- a/net/ipv6/ila/ila_lwt.c > +++ b/net/ipv6/ila/ila_lwt.c > @@ -96,6 +96,14 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) > } > } > > + /* avoid lwtunnel_output() reentry loop when destination is the same > + * after transformation > + */ > + if (orig_dst->lwtstate == dst->lwtstate) { > + dst_release(dst); > + return orig_dst->lwtstate->orig_output(net, sk, skb); > + } > + > skb_dst_drop(skb); > skb_dst_set(skb, dst); > return dst_output(net, sk, skb); Even this pattern is repeated verbatim in patch 3, and I think it should deserve a shared helper. Also a bit of a pity there are a few variations that do not fit cleanly a common helper, but I guess there is little to do about that for 'net'. Thanks, Paolo
On 3/13/25 13:46, Paolo Abeni wrote: > On 3/11/25 3:12 PM, Justin Iurman wrote: >> diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c >> index 7d574f5132e2..67f7c7015693 100644 >> --- a/net/ipv6/ila/ila_lwt.c >> +++ b/net/ipv6/ila/ila_lwt.c >> @@ -96,6 +96,14 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) >> } >> } >> >> + /* avoid lwtunnel_output() reentry loop when destination is the same >> + * after transformation >> + */ >> + if (orig_dst->lwtstate == dst->lwtstate) { >> + dst_release(dst); >> + return orig_dst->lwtstate->orig_output(net, sk, skb); >> + } >> + >> skb_dst_drop(skb); >> skb_dst_set(skb, dst); >> return dst_output(net, sk, skb); > > Even this pattern is repeated verbatim in patch 3, and I think it should > deserve a shared helper. Also a bit of a pity there are a few variations +1 as well. However, same remark applies here: this patch (and some others) will be removed from this series in -v2. > that do not fit cleanly a common helper, but I guess there is little to > do about that for 'net'. Indeed... > Thanks, > > Paolo >
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c index 7d574f5132e2..67f7c7015693 100644 --- a/net/ipv6/ila/ila_lwt.c +++ b/net/ipv6/ila/ila_lwt.c @@ -96,6 +96,14 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) } } + /* avoid lwtunnel_output() reentry loop when destination is the same + * after transformation + */ + if (orig_dst->lwtstate == dst->lwtstate) { + dst_release(dst); + return orig_dst->lwtstate->orig_output(net, sk, skb); + } + skb_dst_drop(skb); skb_dst_set(skb, dst); return dst_output(net, sk, skb);
Fix the lwtunnel_output() reentry loop in ila_lwt when the destination is the same after transformation. Some configurations leading to this may be considered pathological, but we don't want the kernel to crash even for these ones. Fixes: 79ff2fc31e0f ("ila: Cache a route to translated address") Cc: Tom Herbert <tom@herbertland.com> Cc: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Justin Iurman <justin.iurman@uliege.be> --- net/ipv6/ila/ila_lwt.c | 8 ++++++++ 1 file changed, 8 insertions(+)