lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1A61D8EA6755AF458F06EA669A4EC8182F05BCB0@JKLMAIL02.ixonos.local>
Date:	Wed, 6 Jul 2011 14:06:15 +0000
From:	Penttilä Mika <mika.penttila@...nos.com>
To:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:	"davem@...emloft.net" <davem@...emloft.net>
Subject: FW: Re: [PATCH v3 4/4] packet: Add pre-defragmentation support for
 ipv4



> +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


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ