Skip to contentSkip to conversation

bonding: restrict the data protected by rcu_read_lock

PATCH In review Zhu Yanjun 2 participants 2 messages Jul 12, 2016

Subsystems (3)
lore
Share & tools
lore

Zhu Yanjun

author
#0 lore raw

PATCH 1/1 bonding: restrict the data protected by rcu_read_lock

In this function, origin is a pointer to struct aggregator. No matter what agg is changed to, it has nothing to do with origin.

---
 drivers/net/bonding/bond_3ad.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_3ad.c +1 -1
index edc70ff..20afee3 100644
@@ -1624,8 +1624,8 @@ static void ad_agg_selection_logic(struct aggregator *agg,
 	struct slave *slave;
 	struct port *port;
 
-	rcu_read_lock();
 	origin = agg;
+	rcu_read_lock();
 	active = __get_active_agg(agg);
 	best = (active && agg_device_up(active)) ? active : NULL;
 
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

From: Zhu Yanjun <[email protected]>
Date: Tue, 12 Jul 2016 15:28:17 +0800

Quoted 5 lines

In this function, origin is a pointer to struct aggregator. No matter what agg is changed to, it has nothing to do with origin.

I really hate changes like this.

Imagine if a inner function was called with RCU protection around it, as a rule.

That's the same as what is happening here, the RCU locking is done around the entire contents of the function and that is perfectly fine even if one variable assignment or whatever is superfluously contained inside of it.

I'm not applying this patch, sorry.