Netdev List
 help / color / mirror / Atom feed
* FW: Re: [PATCH v3 4/4] packet: Add pre-defragmentation support for ipv4
@ 2011-07-06 14:06 Penttilä Mika
  2011-07-06 15:18 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Penttilä Mika @ 2011-07-06 14:06 UTC (permalink / raw)
  To: netdev@vger.kernel.org; +Cc: davem@davemloft.net



> +static struct sk_buff *fanout_check_defrag(struct sk_buff *skb)
> +{
> +	const struct iphdr *iph;
> +	u32 len;
> +
> +	if (skb->protocol != htons(ETH_P_IP))
> +		return skb;
> +
> +	if (!pskb_may_pull(skb, sizeof(struct iphdr)))
> +		return skb;
> +
> +	iph = ip_hdr(skb);
> +	if (iph->ihl < 5 || iph->version != 4)
> +		return skb;
> +	if (!pskb_may_pull(skb, iph->ihl*4))
> +		return skb;
> +	iph = ip_hdr(skb);
> +	len = ntohs(iph->tot_len);
> +	if (skb->len < len || len < (iph->ihl * 4))
> +		return skb;
> +
> +	if (ip_is_fragment(ip_hdr(skb))) {
> +		skb = skb_clone(skb, GFP_ATOMIC);

Isn't this leaking the original skb?

> +		if (skb) {
> +			if (pskb_trim_rcsum(skb, len))
> +				return skb;
> +			memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
> +			if (ip_defrag(skb, IP_DEFRAG_AF_PACKET))
> +				return NULL;
> +			skb->rxhash = 0;
> +		}
> +	}
> +	return skb;
> +}

-Mika



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-07  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06 14:06 FW: Re: [PATCH v3 4/4] packet: Add pre-defragmentation support for ipv4 Penttilä Mika
2011-07-06 15:18 ` Eric Dumazet
2011-07-06 15:20   ` David Miller
2011-07-06 15:27     ` Eric Dumazet
2011-07-07  7:25       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox