qcacmn: Add null check for mlo api's

When mlo_dev_ctx is not initialized, it causes NULL ptr
access causing crashes.
Add NULL check in mlo api's to avoid the issue.

Change-Id: Icd7472cab22e3ff441cc9327f0443adb939bbc05
CRs-Fixed: 3143777
Cette révision appartient à :
Amruta Kulkarni
2022-03-03 13:36:39 -08:00
révisé par Madan Koyyalamudi
Parent 758039d43d
révision 8d0d85c7e4
2 fichiers modifiés avec 34 ajouts et 2 suppressions

Voir le fichier

@@ -749,6 +749,11 @@ QDF_STATUS wlan_mlo_peer_create(struct wlan_objmgr_vdev *vdev,
/* get ML VDEV from VDEV */
ml_dev = vdev->mlo_dev_ctx;
if (!ml_dev) {
mlo_err("ML dev ctx is NULL");
return QDF_STATUS_E_NULL_VALUE;
}
/* Check resources of Partner VDEV */
if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE) {
status = mlo_dev_get_link_vdevs(vdev, ml_dev,

Voir le fichier

@@ -264,8 +264,14 @@ mlo_cm_handle_connect_in_disconnection_state(struct wlan_objmgr_vdev *vdev,
struct wlan_cm_connect_req *req)
{
struct wlan_mlo_dev_context *mlo_dev_ctx = vdev->mlo_dev_ctx;
struct wlan_mlo_sta *sta_ctx = mlo_dev_ctx->sta_ctx;
struct wlan_mlo_sta *sta_ctx;
if (!mlo_dev_ctx) {
mlo_err("ML dev ctx is NULL");
return;
}
sta_ctx = mlo_dev_ctx->sta_ctx;
if (!sta_ctx->connect_req)
sta_ctx->connect_req = qdf_mem_malloc(
sizeof(struct wlan_cm_connect_req));
@@ -454,7 +460,14 @@ mlo_prepare_and_send_connect(struct wlan_objmgr_vdev *vdev,
{
struct wlan_cm_connect_req req = {0};
struct wlan_mlo_dev_context *mlo_dev_ctx = vdev->mlo_dev_ctx;
struct wlan_mlo_sta *sta_ctx = mlo_dev_ctx->sta_ctx;
struct wlan_mlo_sta *sta_ctx;
if (!mlo_dev_ctx) {
mlo_err("ML dev ctx is NULL");
return;
}
sta_ctx = mlo_dev_ctx->sta_ctx;
mlo_debug("Partner link connect mac:" QDF_MAC_ADDR_FMT " vdev_id:%d",
QDF_MAC_ADDR_REF(wlan_vdev_mlme_get_macaddr(vdev)),
@@ -608,6 +621,11 @@ mlo_update_connected_links_bmap(struct wlan_mlo_dev_context *mlo_dev_ctx,
uint8_t i = 0;
uint8_t j = 0;
if (!mlo_dev_ctx) {
mlo_err("ML dev ctx is NULL");
return;
}
for (i = 0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
if (!mlo_dev_ctx->wlan_vdev_list[i])
continue;
@@ -680,6 +698,11 @@ void mlo_handle_sta_link_connect_failure(struct wlan_objmgr_vdev *vdev,
struct scheduler_msg msg = {0};
QDF_STATUS ret;
if (!mlo_dev_ctx) {
mlo_err("ML dev ctx is NULL");
return;
}
if (vdev != mlo_get_assoc_link_vdev(mlo_dev_ctx)) {
mlo_update_connected_links(vdev, 0);
if (rsp->reason == CM_NO_CANDIDATE_FOUND ||
@@ -1008,6 +1031,10 @@ void mlo_sta_link_handle_pending_connect(struct wlan_objmgr_vdev *vdev)
struct mlo_partner_info partner_info;
struct mlo_link_info partner_link_info;
if (!mlo_dev_ctx) {
mlo_err("ML dev ctx is null");
return;
}
sta_ctx = mlo_dev_ctx->sta_ctx;
ret = wlan_objmgr_vdev_try_get_ref(
vdev,