Bladeren bron

qcacld-3.0: Fix possible null pointer dereference

roam_info may be null pointer and be explicitly
dereferenced when roam_status is
eCSR_ROAM_LOSTLINK in hdd_dis_connect_hanler.
Add null check for roam_info before
getting roam_info->reasonCode.

Change-Id: I11be7b722921a9be8ed1419251f6cbf19506a11d
CRs-Fixed: 2531563
tinlin 5 jaren geleden
bovenliggende
commit
c99fa7f76f
1 gewijzigde bestanden met toevoegingen van 9 en 14 verwijderingen
  1. 9 14
      core/hdd/src/wlan_hdd_assoc.c

+ 9 - 14
core/hdd/src/wlan_hdd_assoc.c

@@ -1759,6 +1759,8 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 		 * by kernel
 		 */
 		if (sendDisconInd) {
+			int reason = WLAN_REASON_UNSPECIFIED;
+
 			if (roam_info && roam_info->disconnect_ies) {
 				disconnect_ies.data =
 					roam_info->disconnect_ies->data;
@@ -1769,28 +1771,21 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 			 * To avoid wpa_supplicant sending "HANGED" CMD
 			 * to ICS UI.
 			 */
-			if (eCSR_ROAM_LOSTLINK == roam_status) {
-				if (roam_info && roam_info->reasonCode ==
+			if (roam_info && eCSR_ROAM_LOSTLINK == roam_status) {
+				reason = roam_info->reasonCode;
+				if (reason ==
 				    eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON)
 					pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n",
 						roam_info->rxRssi);
-				wlan_hdd_cfg80211_indicate_disconnect(
-							dev, false,
-							roam_info->reasonCode,
-							disconnect_ies.data,
-							disconnect_ies.len);
-			} else {
-				wlan_hdd_cfg80211_indicate_disconnect(
+			}
+			wlan_hdd_cfg80211_indicate_disconnect(
 							dev, false,
-							WLAN_REASON_UNSPECIFIED,
+							reason,
 							disconnect_ies.data,
 							disconnect_ies.len);
-			}
 
 			hdd_debug("sent disconnected event to nl80211, reason code %d",
-				(eCSR_ROAM_LOSTLINK == roam_status) ?
-				roam_info->reasonCode :
-				WLAN_REASON_UNSPECIFIED);
+				  reason);
 		}
 
 		/* update P2P connection status */