Browse Source

qcacld-3.0: Avoid access vdev pointer before check

wlan_objmgr_get_vdev_by_id_from_psoc() may return NULL vdev pointer,
add check to avoid access NULL vdev pointer.

This is to fix reported issue by static analyze.

Change-Id: I5d9619e1d0a04bbb68069dde78859a6570e97aaf
CRs-Fixed: 3654411
Will Huang 1 year ago
parent
commit
febc5382dd
1 changed files with 5 additions and 0 deletions
  1. 5 0
      core/sme/src/common/sme_api.c

+ 5 - 0
core/sme/src/common/sme_api.c

@@ -7784,6 +7784,11 @@ int sme_set_peer_ampdu(mac_handle_t mac_handle, uint8_t vdev_id,
 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc,
 						    vdev_id,
 						    WLAN_LEGACY_SME_ID);
+	if (!vdev) {
+		sme_err("vdev null");
+		return -EINVAL;
+	}
+
 	status = wlan_vdev_is_up(vdev);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		sme_debug("vdev id %d not up", vdev_id);