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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 01 Sep 2016 10:03:22 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     helmut.buchsbaum@...il.com
Cc:     tom@...bertland.com, nicolas.ferre@...el.com,
        michal.simek@...inx.com, netdev@...r.kernel.org,
        cyrille.pitchen@...el.com
Subject: Re: [PATCH v2 1/1] net: macb: initialize checksum when using
 checksum offloading

From: Helmut Buchsbaum <helmut.buchsbaum@...il.com>
Date: Mon, 29 Aug 2016 15:57:25 +0200

> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index 89c0cfa..de2f791 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -1323,6 +1323,19 @@ dma_error:
>  	return 0;
>  }
>  
> +static inline void macb_clear_csum(struct sk_buff *skb)
> +{
> +	/* no change for packets without checksum offloading */
> +	if (skb->ip_summed != CHECKSUM_PARTIAL)
> +		return;
> +
> +	/* initialize checksum field
> +	 * This is required - at least for Zynq, which otherwise calculates
> +	 * wrong UDP header checksums for UDP packets with UDP data len <=2
> +	 */
> +	*(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0;
> +}
> +

It is not valid to blindly modify the SKB contents, you must make sure that no
other references to this SKB's data exist.

You do this via skb_cow_head(skb, 0), which may fail.

See for example drivers/net/ethernet/broadcom/tg3.c's tg3_start_xmit()

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ