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
This commit is contained in:
tinlin 2019-09-20 10:43:50 +08:00 committed by nshrivas
parent ba6d1e030a
commit c99fa7f76f

View File

@ -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(
dev, false,
WLAN_REASON_UNSPECIFIED,
disconnect_ies.data,
disconnect_ies.len);
}
wlan_hdd_cfg80211_indicate_disconnect(
dev, false,
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 */