On 08/26/15 at 11:46pm, Pravin B Shelar wrote:
> +     if (ip_tunnel_collect_metadata() || geneve->collect_md) {
> +             __be16 flags;
> +             void *opts;
> +
> +             flags = TUNNEL_KEY | TUNNEL_GENEVE_OPT |
> +                     (gnvh->oam ? TUNNEL_OAM : 0) |
> +                     (gnvh->critical ? TUNNEL_CRIT_OPT : 0);
> +
> +             tun_dst = udp_tun_rx_dst(skb, AF_INET, flags,
> +                                      vni_to_tunnel_id(gnvh->vni),
> +                                      gnvh->opt_len * 4);
> +             if (!tun_dst)
> +                     goto drop;
> +
> +             /* Update tunnel dst according to Geneve options. */
> +             opts = ip_tunnel_info_opts(&tun_dst->u.tun_info,
> +                                        gnvh->opt_len * 4);
> +             memcpy(opts, gnvh->options, gnvh->opt_len * 4);
> +     } else {
> +             /* Drop packets w/ critical options,
> +              * since we don't support any...
> +              */
> +             if (gnvh->critical)
> +                     goto drop;
> +     }
>  
>       skb_reset_mac_header(skb);
>       skb_scrub_packet(skb, !net_eq(geneve->net, dev_net(geneve->dev)));
>       skb->protocol = eth_type_trans(skb, geneve->dev);
>       skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
>  
> +     if (tun_dst)
> +             skb_dst_set(skb, &tun_dst->dst);

It is slightly non obvious that introducing an error condition above
this and before udp_tun_rx_dst() would introduce a memory leak. Other
than this looks great now.

Acked-by: Thomas Graf <tg...@suug.ch>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to