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:   Wed, 7 Jul 2021 09:42:18 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     David Ahern <dsahern@...il.com>
Cc:     Vasily Averin <vvs@...tuozzo.com>,
        "David S. Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH IPV6 1/1] ipv6: allocate enough headroom in
 ip6_finish_output2()

On Wed, 7 Jul 2021 08:45:13 -0600 David Ahern wrote:
> On 7/7/21 8:04 AM, Vasily Averin wrote:
> > diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> > index ff4f9eb..e5af740 100644
> > --- a/net/ipv6/ip6_output.c
> > +++ b/net/ipv6/ip6_output.c
> > @@ -61,9 +61,24 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
> >  	struct dst_entry *dst = skb_dst(skb);
> >  	struct net_device *dev = dst->dev;
> >  	const struct in6_addr *nexthop;
> > +	unsigned int hh_len = LL_RESERVED_SPACE(dev);
> >  	struct neighbour *neigh;
> >  	int ret;
> >  
> > +	/* Be paranoid, rather than too clever. */
> > +	if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
> > +		struct sk_buff *skb2;
> > +
> > +		skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));  
> 
> why not use hh_len here?

Is there a reason for the new skb? Why not pskb_expand_head()?

> > +		if (!skb2) {
> > +			kfree_skb(skb);
> > +			return -ENOMEM;
> > +		}
> > +		if (skb->sk)
> > +			skb_set_owner_w(skb2, skb->sk);
> > +		consume_skb(skb);
> > +		skb = skb2;
> > +	}
> >  	if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
> >  		struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ