qcacld-3.0: Fix dsc_vdev leak when create exist softap

If add softap which name already exist, wlan_hdd_allow_sap_add() will
return the exist softap, which check as valid wdev in function
_wlan_hdd_add_virtual_intf(), so we created useless dsc_vdev for this
duplicanted softap, and upper layer has no chance to delete it because
it only has unique softap.

Fix it by removing wlan_hdd_allow_sap_add() checking because kernel
will check duplicated naming when register interface.

Change-Id: Ic6ffa793a678cfdeb43ecd6c472e8a70c8a150f1
CRs-Fixed: 2661354
This commit is contained in:
Will Huang 2020-04-14 18:12:48 +08:00 • committed by nshrivas
commit dd01f5ba00

View file

@ -611,48 +611,6 @@ int hdd_set_p2p_ps(struct net_device *dev, void *msgData)
return wlan_hdd_set_power_save(adapter, &noa);
}
/**
* wlan_hdd_allow_sap_add() - check to add new sap interface
* @hdd_ctx: pointer to hdd context
* @name: name of the new interface
* @sap_dev: output pointer to hold existing interface
*
* Return: If able to add interface return true else false
*/
static bool
wlan_hdd_allow_sap_add(struct hdd_context *hdd_ctx, const char *name,
struct wireless_dev **sap_dev)
{
struct hdd_adapter *adapter;
*sap_dev = NULL;
hdd_for_each_adapter(hdd_ctx, adapter) {
if (adapter->device_mode == QDF_SAP_MODE &&
test_bit(NET_DEVICE_REGISTERED, &adapter->event_flags) &&
adapter->dev &&
!strncmp(adapter->dev->name, name, IFNAMSIZ)) {
struct hdd_beacon_data *beacon =
adapter->session.ap.beacon;
hdd_debug("iface already registered");
if (beacon) {
adapter->session.ap.beacon = NULL;
qdf_mem_free(beacon);
}
if (adapter->dev->ieee80211_ptr) {
*sap_dev = adapter->dev->ieee80211_ptr;
return false;
}
hdd_err("ieee80211_ptr points to NULL");
return false;
}
}
return true;
}
/**
* __wlan_hdd_add_virtual_intf() - Add virtual interface
* @wiphy: wiphy pointer
@ -736,18 +694,6 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
}
}
if (mode == QDF_SAP_MODE) {
struct wireless_dev *sap_dev;
bool allow_add_sap = wlan_hdd_allow_sap_add(hdd_ctx, name,
&sap_dev);
if (!allow_add_sap) {
if (sap_dev)
return sap_dev;
return ERR_PTR(-EINVAL);
}
}
adapter = NULL;
cfg_p2p_get_device_addr_admin(hdd_ctx->psoc, &p2p_dev_addr_admin);
if (p2p_dev_addr_admin &&