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

Commit d119da3f authored by Bapiraju Alla's avatar Bapiraju Alla
Browse files

wlan: Handle session leak during change interface

Currently in change interface, the status of the interface is not being
checked before initializing the mode. If the interface is down, one more
session will be created when interface up is triggered. In this case,
the session created during the change interface will not be deleted.

To handle this, check for interface up before initializing the mode
during change interface.

Change-Id: Ifbcbfa7249e3ecacc4259000aa7558eeecdfb5f3
CRs-Fixed: 2782058
parent b01bf123
Loading
Loading
Loading
Loading
+26 −10
Original line number Diff line number Diff line
@@ -12491,6 +12491,7 @@ int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy,
    eMib_dot11DesiredBssType connectedBssType;
    VOS_STATUS status;
    long ret;
    bool iff_up = ndev->flags & IFF_UP;
    ENTER();
@@ -12763,13 +12764,21 @@ int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy,
                         return -EINVAL;
                    }
                }
		if (iff_up) {
			hddLog(VOS_TRACE_LEVEL_DEBUG,
			       "%s: SAP interface is already up", __func__);
			status = hdd_init_ap_mode(pAdapter, false);
			if(status != VOS_STATUS_SUCCESS)
			{
				hddLog(VOS_TRACE_LEVEL_FATAL,
                           "%s: Error initializing the ap mode", __func__);
				       "%s: Error initializing the ap mode",
				       __func__);
				return -EINVAL;
			}
		} else {
			hddLog(VOS_TRACE_LEVEL_DEBUG,
			       "%s: SAP interface is down", __func__);
		}
                hdd_set_conparam(1);
                status = hdd_sta_id_hash_attach(pAdapter);
@@ -12855,9 +12864,16 @@ int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy,
#ifdef FEATURE_WLAN_TDLS
                mutex_unlock(&pHddCtx->tdls_lock);
#endif
		if (iff_up) {
			hddLog(VOS_TRACE_LEVEL_DEBUG,
			       "%s: STA interface is already up", __func__);
			status = hdd_init_station_mode( pAdapter );
			if( VOS_STATUS_SUCCESS != status )
				return -EOPNOTSUPP;
		} else {
			hddLog(VOS_TRACE_LEVEL_DEBUG,
			       "%s: STA interface is down", __func__);
		}
                /* In case of JB, for P2P-GO, only change interface will be called,
                 * This is the right place to enable back bmps_imps()
                 */
+18 −13
Original line number Diff line number Diff line
@@ -223,13 +223,14 @@ int __hdd_hostapd_open (struct net_device *dev)
       }
   }

   if (!test_bit(SME_SESSION_OPENED, &pAdapter->event_flags)) {
	   status = hdd_init_ap_mode( pAdapter, false);
	   if( VOS_STATUS_SUCCESS != status ) {
          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to create session for station mode",
		   hddLog(VOS_TRACE_LEVEL_ERROR,
			  "%s: Failed to create session for station mode",
			  __func__);
		   return -EINVAL;
	   }

	   set_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags);

	   //Turn ON carrier state
@@ -237,6 +238,10 @@ int __hdd_hostapd_open (struct net_device *dev)
	   //Enable all Tx queues
	   hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues"));
	   netif_tx_start_all_queues(dev);
   } else {
	   hddLog(VOS_TRACE_LEVEL_DEBUG,
		  "%s: session already exist for AP mode", __func__);
   }

   EXIT();
   return 0;
+11 −5
Original line number Diff line number Diff line
@@ -8264,12 +8264,18 @@ int __hdd_open(struct net_device *dev)
       }
   }
   if (!test_bit(SME_SESSION_OPENED, &pAdapter->event_flags)) {
	   status = hdd_init_station_mode( pAdapter );
	   if( VOS_STATUS_SUCCESS != status ) {
          hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to create session for station mode",
		   hddLog(VOS_TRACE_LEVEL_ERROR,
			  "%s: Failed to create session for station mode",
			  __func__);
		   return -EINVAL;
	   }
   } else {
	   hddLog(VOS_TRACE_LEVEL_DEBUG,
		  "%s: session already exist for station mode", __func__);
   }
   hdd_sysfs_bt_profile_create(pHddCtx);