Search Linux Wireless

locking in wiphy_apply_custom_regulatory()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johannes,

I stumbled upon locking in wiphy_apply_custom_regulatory() and the history of commits make it a bit unclear to me if these locks are all really needed.

beee246951571 added the rcu assignments without any locking.
51d62f2f2c501 added the rtnl locking.
a05829a7222e9 added the wiphy lock.

My understanding of RCU operations was that locking is only needed for readers, but here we use not one but two mutex locks which makes me wonder. Especially, as this function is called before registering the wiphy.

Could you clarify?

Thanks,
Arend

---8<---------------------------------------------------------------
	/*
	 * no point in calling this if it won't have any effect
	 * on your device's supported bands.
	 */
	WARN_ON(!bands_set);
	new_regd = reg_copy_regd(regd);
	if (IS_ERR(new_regd))
		return;

	rtnl_lock();
	wiphy_lock(wiphy);

	tmp = get_wiphy_regdom(wiphy);
	rcu_assign_pointer(wiphy->regd, new_regd);
	rcu_free_regdom(tmp);

	wiphy_unlock(wiphy);
	rtnl_unlock();
}
EXPORT_SYMBOL(wiphy_apply_custom_regulatory);

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux