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:	Fri, 6 Nov 2009 18:35:24 +0200
From:	Lucian Adrian Grijincu <lgrijincu@...acom.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
	opurdila@...acom.com
Subject: Re: [PATCH net-next-2.6] udp: Optimise multicast reception

În data de Vin 06 Noi 2009 17:59:51 ați scris:
> +static void flush_stack(struct sock **stack, unsigned int count,
> +                       struct sk_buff *skb, unsigned int final)
> +{
> +       unsigned int i;
> +       struct sk_buff *skb1 = NULL;
> +
> +       for (i = 0; i < count; i++) {
> +             if (likely(skb1 == NULL))
> +                    skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC);
> +
> +               if (skb1 && udp_queue_rcv_skb(stack[i], skb1) <= 0)
> +                       skb1 = NULL;
> +       }
> +       if (skb1)
> +               consume_skb(skb1);
> +}

consume_skb() assumes the skb was successfuly transmitted.

free_skb() does the same thing, but assumes that the frame is being dropped 
after a failure and notes that.

In your code, if (count == 0) you:
* fail to remove the original skb (memory leak), 
* simply consume the last dropped skb, without noting the droping failure.

I fixed these in the attached (untested) patch.

One last issue: you silently ignore dropped failures (skb1 is reused in case 
of a failure).

If this tracing must record all failures, I'd add an
	trace_kfree_skb(skb1, __builtin_return_address(0));
if udp_queue_rcv_skb() fails.

Other than this, nicely done!
-- 
Lucian

View attachment "udp-optimise-multicast-reception.patch" of type "text/plain" (2360 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ