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: <CAHXqBF+uHoGRXP3HdiL2Zm9RUhT-+7RsrRhAYZyEg-FjzH2-eQ@mail.gmail.com>
Date:	Fri, 25 Jan 2013 02:21:06 +0100
From:	Michał Mirosław <mirqus@...il.com>
To:	Pravin B Shelar <pshelar@...ira.com>
Cc:	netdev@...r.kernel.org, jesse@...ira.com, eric.dumazet@...il.com
Subject: Re: [PATCH 1/2] net: Add skb_unclone() helper function.

2013/1/24 Pravin B Shelar <pshelar@...ira.com>:
[...]
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -798,6 +798,19 @@ static inline int skb_cloned(const struct sk_buff *skb)
>  }
>
>  /**
> + *     skb_unclone - creates separate copy if skb is cloned.
> + */
> +static inline bool skb_unclone(struct sk_buff *skb, gfp_t pri)
> +{
> +       might_sleep_if(pri & __GFP_WAIT);
> +
> +       if (skb_cloned(skb))
> +               return pskb_expand_head(skb, 0, 0, pri);
> +
> +       return 0;
> +}

This should return int. pskb_expand_head() returns 0 or -ENOMEM.

[...]
> diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
> index ddee0a0..c1f00ef 100644
> --- a/net/ipv4/xfrm4_mode_tunnel.c
> +++ b/net/ipv4/xfrm4_mode_tunnel.c
> @@ -142,8 +142,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
>         for_each_input_rcu(rcv_notify_handlers, handler)
>                 handler->handler(skb);
>
> -       if (skb_cloned(skb) &&
> -           (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
> +       if (skb_unclone(skb, GFP_ATOMIC))
>                 goto out;

And here return -ENOMEM is replaced with return -EINVAL because of this.

Best Regards,
Michał Mirosław
--
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