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]
Message-ID: <20181220192940.rdgd6zslytqiyzyo@breakpoint.cc>
Date:   Thu, 20 Dec 2018 20:29:40 +0100
From:   Florian Westphal <fw@...len.de>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     netdev@...r.kernel.org, Florian Westphal <fw@...len.de>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next 3/3] net: minor cleanup in skb_ext_add()

Paolo Abeni <pabeni@...hat.com> wrote:
> When the extension to be added is already present, the only
> skb field we may need to update is 'extensions': we can reorder
> the code and avoid a branch.
>
> Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> ---
>  net/core/skbuff.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index e1d88762f659..38afa3ff2b44 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -5666,11 +5666,8 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id)
>  		if (!new)
>  			return NULL;
>  
> -		if (__skb_ext_exist(new, id)) {
> -			if (old != new)
> -				skb->extensions = new;

Yes, the old != new check can be avoided, we would
replace "extensions" with the same content.

> +		if (__skb_ext_exist(new, id))
>  			goto set_active;
> -		}
>  
>  		newoff = new->chunks;
>  	} else {
> @@ -5684,9 +5681,9 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id)
>  	newlen = newoff + skb_ext_type_len[id];
>  	new->chunks = newlen;
>  	new->offset[id] = newoff;
> -	skb->extensions = new;
> -set_active:
>  	skb->active_extensions |= 1 << id;
> +set_active:
> +	skb->extensions = new;

Why are you moving the label?
I don't think thats correct.

We must make sure the id is flagged as active in
active_extensions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ