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:	Thu, 05 Dec 2013 04:33:55 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Veaceslav Falico <vfalico@...hat.com>
Cc:	Nikolay Aleksandrov <nikolay@...hat.com>, netdev@...r.kernel.org,
	Andy Gospodarek <andy@...yhouse.net>,
	Jay Vosburgh <fubar@...ibm.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net] bonding: fix packets_per_slave showing

On Thu, 2013-12-05 at 12:08 +0100, Veaceslav Falico wrote:
> On Thu, Dec 05, 2013 at 11:36:58AM +0100, Nikolay Aleksandrov wrote:
> >There's an issue when showing the value of packets_per_slave due to
> >using signed integer. The value may be < 0 and thus not put through
> >reciprocal_value() before showing. This patch makes it use unsigned
> >integer when showing it.
> 
> I was already checking my basic algebra knowledge here,
> reciprocal_value(reciprocal_value(0..USHRT_MAX)) can become negative?!? :)
> 
> If anyone's also wondering...
> 
> packets_per_slave is reciprocal_value(0..USHRT_MAX), and thus can indeed be
> negative, and then the code
> 
> 	if (packets_per_slave > 1)
> 		packets_per_slave = reciprocal_value(packets_per_slave);
> 
> would fail to recognise that it's a reciprocal_divide() value, and not a
> standard 0/1 option (in bond_rr_gen_slave_id() we verify it via a switch,
> so we're safe there) - and thus output nonsense.
> 
> Acked-by: Veaceslav Falico <vfalico@...hat.com>

This code is very confusing.

Please rename bond->params.packets_per_slave
to bond->params.reciprocal_packets_per_slave 

To make clear that its the reciprocal value.

Also the module parameter is named packets_per_slave, it would be nice
if same name was not reused as local variable in bond_rr_gen_slave_id()

bond_check_params() reads the sys value several times.

This is racy with /sys access.

You should use ACCESS_ONCE() to make sure nothing bad happens.



--
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