@@ -247,6 +247,14 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb)
goto drop;
}
+ /* 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);
@@ -305,6 +313,12 @@ static int rpl_input(struct sk_buff *skb)
skb_dst_set(skb, dst);
}
+ /* avoid lwtunnel_input() reentry loop when destination is the same
+ * after transformation
+ */
+ if (lwtst == dst->lwtstate)
+ return dst->lwtstate->orig_input(skb);
+
return dst_input(skb);
drop:
Fix the lwtunnel_input() and lwtunnel_output() reentry loop in rpl_iptunnel 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: a7a29f9c361f ("net: ipv6: add rpl sr tunnel") Cc: Alexander Aring <alex.aring@gmail.com> Cc: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Justin Iurman <justin.iurman@uliege.be> --- net/ipv6/rpl_iptunnel.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)