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] [day] [month] [year] [list]
Message-ID: <1477050221.4606.6.camel@redhat.com>
Date:   Fri, 21 Oct 2016 13:43:41 +0200
From:   Paolo Abeni <pabeni@...hat.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        James Morris <jmorris@...ei.org>,
        Trond Myklebust <trond.myklebust@...marydata.com>,
        Alexander Duyck <aduyck@...antis.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Tom Herbert <tom@...bertland.com>,
        Hannes Frederic Sowa <hannes@...essinduktion.org>,
        Edward Cree <ecree@...arflare.com>, linux-nfs@...r.kernel.org
Subject: Re: [PATCH net-next v5 2/3] udp: implement memory accounting helpers

On Thu, 2016-10-20 at 14:10 -0700, Eric Dumazet wrote:
> On Thu, 2016-10-20 at 22:31 +0200, Paolo Abeni wrote:
> 
> > +
> > +int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
> > +{
> > +	struct sk_buff_head *list = &sk->sk_receive_queue;
> > +	int rmem, delta, amt, err = -ENOMEM;
> > +	int size = skb->truesize;
> > +
> > +	/* try to avoid the costly atomic add/sub pair when the receive
> > +	 * queue is full; always allow at least a packet
> > +	 */
> > +	rmem = atomic_read(&sk->sk_rmem_alloc);
> > +	if (rmem && (rmem + size > sk->sk_rcvbuf))
> > +		goto drop;
> > +
> > +	/* we drop only if the receive buf is full and the receive
> > +	 * queue contains some other skb
> > +	 */
> > +	rmem = atomic_add_return(size, &sk->sk_rmem_alloc);
> > +	if ((rmem > sk->sk_rcvbuf) && (rmem > size))
> > +		goto uncharge_drop;
> > +
> > +	skb_orphan(skb);
> 
> Minor point :
> 
> UDP should already have orphaned skbs ? (it uses skb_steal_sock())

You are right, the skb_orphan() call is redundant. 

I'll send the v6 soon.

Thank you,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ