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:	Mon, 29 Sep 2014 18:30:18 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 net-next] net: cleanup and document skb fclone layout

On Mon, 2014-09-29 at 13:29 -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
> 

>  struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
>  {
> -	struct sk_buff *n;
> +	struct sk_buff_fclones *fclones = container_of(skb,
> +						       struct sk_buff_fclones,
> +						       skb1);
> +	struct sk_buff *n = &fclones->skb2;
>  
>  	if (skb_orphan_frags(skb, gfp_mask))
>  		return NULL;
>  
> -	n = skb + 1;
>  	if (skb->fclone == SKB_FCLONE_ORIG &&
>  	    n->fclone == SKB_FCLONE_UNAVAILABLE) {
> -		atomic_t *fclone_ref = (atomic_t *) (n + 1);
>  		n->fclone = SKB_FCLONE_CLONE;
> -		atomic_inc(fclone_ref);
> +		atomic_inc(&fclones->fclone_ref);
>  	} else {
>  		if (skb_pfmemalloc(skb))
>  			gfp_mask |= __GFP_MEMALLOC;

Note : 

The "atomic_inc(&fclones->fclone_ref)" here can be replaced by an
atomic_set(&fclones->fclone_ref, 2), to avoid a locked operation.


I'll cook a patch for this, after you merged this cleanup

Thanks


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