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

Commit 653399f2 authored by Liangwei Dong's avatar Liangwei Dong Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: acquire lock before update connection list

Acquire connection list lock in policy mgr before update the
entry. The "conn_index" maybe changed for a connection entry
if other connection is up or down.
Fix by acquire connection to protect the whole "update" operation.

Change-Id: I91e82e74884ef32e83e0c4105e88bafe8d99db3d
CRs-Fixed: 2848209
parent 27098888
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -332,8 +333,9 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
		}
		conn_index++;
	}
	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);

	if (!found) {
		qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
		/* err msg */
		policy_mgr_err("can't find vdev_id %d in pm_conc_connection_list",
			vdev_id);
@@ -343,11 +345,13 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
		status = pm_ctx->wma_cbacks.wma_get_connection_info(
				vdev_id, &conn_table_entry);
		if (QDF_STATUS_SUCCESS != status) {
			qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
			policy_mgr_err("can't find vdev_id %d in connection table",
			vdev_id);
			return status;
		}
	} else {
		qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
		policy_mgr_err("wma_get_connection_info is NULL");
		return QDF_STATUS_E_FAILURE;
	}
@@ -375,7 +379,7 @@ QDF_STATUS policy_mgr_update_connection_info(struct wlan_objmgr_psoc *psoc,
			policy_mgr_get_bw(conn_table_entry.chan_width),
			conn_table_entry.mac_id, chain_mask,
			nss, vdev_id, true, true, conn_table_entry.ch_flagext);

	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
	/* do we need to change the HW mode */
	policy_mgr_check_n_start_opportunistic_timer(psoc);