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

Commit 7a947080 authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by John W. Linville
Browse files

mac80211: Free current bss information in few places where we don't need it any more

parent 029bc432
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -955,6 +955,8 @@ ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
		     u8 *ssid, u8 ssid_len);
		     u8 *ssid, u8 ssid_len);
void ieee80211_rx_bss_put(struct ieee80211_local *local,
void ieee80211_rx_bss_put(struct ieee80211_local *local,
			  struct ieee80211_bss *bss);
			  struct ieee80211_bss *bss);
void ieee80211_rx_bss_remove(struct ieee80211_sub_if_data *sdata, u8 *bssid,
			     int freq, u8 *ssid, u8 ssid_len);


/* interface handling */
/* interface handling */
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
+21 −17
Original line number Original line Diff line number Diff line
@@ -840,6 +840,14 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
		       sdata->dev->name, ifsta->bssid);
		       sdata->dev->name, ifsta->bssid);
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ieee80211_sta_send_apinfo(sdata, ifsta);
		ieee80211_sta_send_apinfo(sdata, ifsta);

		/*
		 * Most likely AP is not in the range so remove the
		 * bss information associated to the AP
		 */
		ieee80211_rx_bss_remove(sdata, ifsta->bssid,
				sdata->local->hw.conf.channel->center_freq,
				ifsta->ssid, ifsta->ssid_len);
		return;
		return;
	}
	}


@@ -871,6 +879,9 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
		       sdata->dev->name, ifsta->bssid);
		       sdata->dev->name, ifsta->bssid);
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ieee80211_sta_send_apinfo(sdata, ifsta);
		ieee80211_sta_send_apinfo(sdata, ifsta);
		ieee80211_rx_bss_remove(sdata, ifsta->bssid,
				sdata->local->hw.conf.channel->center_freq,
				ifsta->ssid, ifsta->ssid_len);
		return;
		return;
	}
	}


@@ -933,8 +944,12 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,


	ieee80211_sta_send_apinfo(sdata, ifsta);
	ieee80211_sta_send_apinfo(sdata, ifsta);


	if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT)
	if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT) {
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ieee80211_rx_bss_remove(sdata, ifsta->bssid,
				sdata->local->hw.conf.channel->center_freq,
				ifsta->ssid, ifsta->ssid_len);
	}


	rcu_read_unlock();
	rcu_read_unlock();


@@ -1017,6 +1032,9 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata,
		       sdata->dev->name, ifsta->bssid);
		       sdata->dev->name, ifsta->bssid);
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ifsta->state = IEEE80211_STA_MLME_DISABLED;
		ieee80211_sta_send_apinfo(sdata, ifsta);
		ieee80211_sta_send_apinfo(sdata, ifsta);
		ieee80211_rx_bss_remove(sdata, ifsta->bssid,
				sdata->local->hw.conf.channel->center_freq,
				ifsta->ssid, ifsta->ssid_len);
		return;
		return;
	}
	}


@@ -1042,7 +1060,6 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_local *local = sdata->local;
	struct sta_info *sta;
	struct sta_info *sta;
	int disassoc;
	int disassoc;
	bool remove_bss = false;


	/* TODO: start monitoring current AP signal quality and number of
	/* TODO: start monitoring current AP signal quality and number of
	 * missed beacons. Scan other channels every now and then and search
	 * missed beacons. Scan other channels every now and then and search
@@ -1068,7 +1085,6 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,
				       "range\n",
				       "range\n",
				       sdata->dev->name, ifsta->bssid);
				       sdata->dev->name, ifsta->bssid);
				disassoc = 1;
				disassoc = 1;
				remove_bss = true;
			} else
			} else
				ieee80211_send_probe_req(sdata, ifsta->bssid,
				ieee80211_send_probe_req(sdata, ifsta->bssid,
							 ifsta->ssid,
							 ifsta->ssid,
@@ -1088,25 +1104,13 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata,


	rcu_read_unlock();
	rcu_read_unlock();


	if (disassoc) {
	if (disassoc)
		ieee80211_set_disassoc(sdata, ifsta, true, true,
		ieee80211_set_disassoc(sdata, ifsta, true, true,
					WLAN_REASON_PREV_AUTH_NOT_VALID);
					WLAN_REASON_PREV_AUTH_NOT_VALID);
		if (remove_bss) {
	else
			struct ieee80211_bss *bss;

			bss = ieee80211_rx_bss_get(local, ifsta->bssid,
					local->hw.conf.channel->center_freq,
					ifsta->ssid, ifsta->ssid_len);
			if (bss) {
				atomic_dec(&bss->users);
				ieee80211_rx_bss_put(local, bss);
			}
		}
	} else {
		mod_timer(&ifsta->timer, jiffies +
		mod_timer(&ifsta->timer, jiffies +
				      IEEE80211_MONITORING_INTERVAL);
				      IEEE80211_MONITORING_INTERVAL);
}
}
}




static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata,
static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata,
+13 −0
Original line number Original line Diff line number Diff line
@@ -327,6 +327,19 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
	return bss;
	return bss;
}
}


void ieee80211_rx_bss_remove(struct ieee80211_sub_if_data *sdata, u8 *bssid,
			     int freq, u8 *ssid, u8 ssid_len)
{
	struct ieee80211_bss *bss;
	struct ieee80211_local *local = sdata->local;

	bss = ieee80211_rx_bss_get(local, bssid, freq, ssid, ssid_len);
	if (bss) {
		atomic_dec(&bss->users);
		ieee80211_rx_bss_put(local, bss);
	}
}

ieee80211_rx_result
ieee80211_rx_result
ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
		  struct ieee80211_rx_status *rx_status)
		  struct ieee80211_rx_status *rx_status)