Merge "qcacmn: Fix possible OOB access while sending NAN msg to firmware"
diff --git a/wmi_unified.c b/wmi_unified.c
index 006154c..0ced7e7 100644
--- a/wmi_unified.c
+++ b/wmi_unified.c
@@ -2193,6 +2193,10 @@
param->rx_ops->wma_process_fw_event_handler_cbk;
wmi_handle->target_type = param->target_type;
soc->target_type = param->target_type;
+
+ if (param->target_type >= WMI_MAX_TARGET_TYPE)
+ goto error;
+
if (wmi_attach_register[param->target_type]) {
wmi_attach_register[param->target_type](wmi_handle);
} else {