Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c2bef46 authored by Monam Agarwal's avatar Monam Agarwal Committed by Johannes Berg
Browse files

mac80211: use RCU_INIT_POINTER



rcu_assign_pointer() ensures that the initialization of a structure is
carried out before storing a pointer to that structure. However, in the
case that NULL is assigned there's no structure to initialize so using
RCU_INIT_POINTER instead is safe and more efficient.

Signed-off-by: default avatarMonam Agarwal <monamagarwal123@gmail.com>
[squash eight tiny patches, rewrite commit log]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 34dd886c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1566,7 +1566,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,

		if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
		    sta->sdata->u.vlan.sta) {
			rcu_assign_pointer(sta->sdata->u.vlan.sta, NULL);
			RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);
			prev_4addr = true;
		}

+1 −1
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
	lockdep_assert_held(&local->chanctx_mtx);

	ctx->refcount--;
	rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
	RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL);

	sdata->vif.bss_conf.idle = true;

+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static ssize_t sta_tx_latency_stat_write(struct file *file,
	if (!strcmp(buf, TX_LATENCY_DISABLED)) {
		if (!tx_latency)
			goto unlock;
		rcu_assign_pointer(local->tx_latency, NULL);
		RCU_INIT_POINTER(local->tx_latency, NULL);
		synchronize_rcu();
		kfree(tx_latency);
		goto unlock;
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,

	presp = rcu_dereference_protected(ifibss->presp,
					  lockdep_is_held(&sdata->wdev.mtx));
	rcu_assign_pointer(ifibss->presp, NULL);
	RCU_INIT_POINTER(ifibss->presp, NULL);
	if (presp)
		kfree_rcu(presp, rcu_head);

+4 −4
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
	mutex_unlock(&local->mtx);
	if (ret) {
		mutex_lock(&local->iflist_mtx);
		rcu_assign_pointer(local->monitor_sdata, NULL);
		RCU_INIT_POINTER(local->monitor_sdata, NULL);
		mutex_unlock(&local->iflist_mtx);
		synchronize_net();
		drv_remove_interface(local, sdata);
@@ -452,7 +452,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
		return;
	}

	rcu_assign_pointer(local->monitor_sdata, NULL);
	RCU_INIT_POINTER(local->monitor_sdata, NULL);
	mutex_unlock(&local->iflist_mtx);

	synchronize_net();
@@ -876,7 +876,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
	switch (sdata->vif.type) {
	case NL80211_IFTYPE_AP_VLAN:
		list_del(&sdata->u.vlan.list);
		rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
		RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL);
		/* no need to tell driver */
		break;
	case NL80211_IFTYPE_MONITOR:
@@ -895,7 +895,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
		break;
	case NL80211_IFTYPE_P2P_DEVICE:
		/* relies on synchronize_rcu() below */
		rcu_assign_pointer(local->p2p_sdata, NULL);
		RCU_INIT_POINTER(local->p2p_sdata, NULL);
		/* fall through */
	default:
		cancel_work_sync(&sdata->work);
Loading