bonding: fix two race conditions in bond_store_updelay/downdelay
authorNikolay Aleksandrov <nikolay@redhat.com>
Wed, 13 Nov 2013 16:07:46 +0000 (17:07 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:32 +0000 (04:33 +0000)
commit3df3359dc058f0bfcfddd761caf849fe807122c5
tree645887a181a5d192937871de2fec9b92dd719ff0
parent1bc5b60197d01f5ebb4043ade11de540b2652024
bonding: fix two race conditions in bond_store_updelay/downdelay

[ Upstream commit b869ccfab1e324507fa3596e3e1308444fb68227 ]

This patch fixes two race conditions between bond_store_updelay/downdelay
and bond_store_miimon which could lead to division by zero as miimon can
be set to 0 while either updelay/downdelay are being set and thus miss the
zero check in the beginning, the zero div happens because updelay/downdelay
are stored as new_value / bond->params.miimon. Use rtnl to synchronize with
miimon setting.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Acked-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/bonding/bond_sysfs.c