[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1410533152.7106.95.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Fri, 12 Sep 2014 07:45:52 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Nikolay Aleksandrov <nikolay@...hat.com>
Cc: netdev@...r.kernel.org, Jiri Pirko <jiri@...nulli.us>,
Andy Gospodarek <andy@...yhouse.net>,
Jay Vosburgh <j.vosburgh@...il.com>,
Veaceslav Falico <vfalico@...il.com>
Subject: Re: [PATCH net] bonding: fix div by zero while enslaving and
transmitting
On Fri, 2014-09-12 at 15:33 +0200, Nikolay Aleksandrov wrote:
> One more thing, netdev_master_upper_dev_link_private() which is called
> after the increment uses list_add_rcu() (i.e. rcu_assign_pointer) to insert
> the slave, so there's a barrier there to ensure this is visible before the
> slave is linked.
You missed my point.
You fixed the writer side, without adding barriers on the read side.
Without looking at the code, just reading your patch, I spot a problem.
Following code is fundamentally broken :
rcu_read_lock();
if (bond->list) {
x = y % bond->slave; // bug : cpu could fetch bond->slave before bond->list
rcu_read_unlock();
Because it needs a read barrier, since the writer does after your patch:
update bond->slave
smp_wmb();
update bond->list
I repeat : adding few rcu_read_lock() / rcu_read_unlock() /
rcu_assign_pointer() calls is not enough to guarantee code is not
broken.
--
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