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-prev] [day] [month] [year] [list]
Date:	Fri, 31 May 2013 11:37:11 +0900
From:	Simon Horman <horms@...ge.net.au>
To:	Pablo Neira Ayuso <pablo@...filter.org>,
	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
	Chen Gang <gang.chen@...anux.com>
Subject: Re: [PATCH v2] netfilter: Correct calculation using skb->tail and
 skb-network_header

On Fri, May 31, 2013 at 09:05:46AM +0900, Simon Horman wrote:
> This corrects an regression introduced by "net: Use 16bits for *_headers
> fields of struct skbuff" when NET_SKBUFF_DATA_USES_OFFSET is not set. In
> that case skb->tail will be a pointer whereas skb->network_header
> will be an offset from head. This is corrected by using wrappers that
> ensure that calculations are always made using pointers.
> 
> Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
> Reported-by: Chen Gang <gang.chen@...anux.com>
> Signed-off-by: Simon Horman <horms@...ge.net.au>

I forgot to note in the subject that this patch is for net-next.
I will re-post accordingly.

> 
> --
> v2
> * Use skb_tail_pointer() to ensure the tail portion of the calculation is
>   always a pointer - it is not if NET_SKBUFF_DATA_USES_OFFSET is not set.
> ---
>  net/netfilter/nf_nat_helper.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nf_nat_helper.c b/net/netfilter/nf_nat_helper.c
> index 5fea563..85e20a9 100644
> --- a/net/netfilter/nf_nat_helper.c
> +++ b/net/netfilter/nf_nat_helper.c
> @@ -104,7 +104,7 @@ static void mangle_contents(struct sk_buff *skb,
>  	/* move post-replacement */
>  	memmove(data + match_offset + rep_len,
>  		data + match_offset + match_len,
> -		skb->tail - (skb->network_header + dataoff +
> +		skb_tail_pointer(skb) - (skb_network_header(skb) + dataoff +
>  			     match_offset + match_len));
>  
>  	/* insert data from buffer */
> -- 
> 1.7.10.4
> 
--
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