소스 검색

qcacld-3.0: Fix ref count leak in set hw mode function

In set hw mode function, Vdev reference count is not
freed in all error paths, and it causes leak in
the system.
Release the vdev ref count in all error handling
path.

Change-Id: Ib63a00c1cb601937925b49064719078b7e9a57d1
CRs-Fixed: 2140442
Kabilan Kannan 7 년 전
부모
커밋
bfa9220002
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 3
      core/sme/src/common/sme_api.c

+ 8 - 3
core/sme/src/common/sme_api.c

@@ -166,18 +166,18 @@ static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg)
 	entry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK);
 	if (!entry) {
 		sme_err("No cmd found in active list");
-		return QDF_STATUS_E_FAILURE;
+		goto error_path;
 	}
 
 	command = GET_BASE_ADDR(entry, tSmeCmd, Link);
 	if (!command) {
 		sme_err("Base address is NULL");
-		return QDF_STATUS_E_FAILURE;
+		goto error_path;
 	}
 
 	if (e_sme_command_set_hw_mode != command->command) {
 		sme_err("Command mismatch!");
-		return QDF_STATUS_E_FAILURE;
+		goto error_path;
 	}
 
 	callback = command->u.set_hw_mode_cmd.set_hw_mode_cb;
@@ -239,6 +239,11 @@ end:
 		csr_release_command(mac, command);
 
 	return QDF_STATUS_SUCCESS;
+
+error_path:
+	wlan_objmgr_vdev_release_ref(command->u.set_hw_mode_cmd.vdev,
+		WLAN_LEGACY_SME_ID);
+	return QDF_STATUS_E_FAILURE;
 }
 
 /**