qcacld-3.0: Validate vdev in target_if_nan_set_vdev_feature_config

In the api target_if_nan_set_vdev_feature_config (),
vdev is not validated before sending vdev set param cmd
to FW which results in crash for invalid vdev.

Validate vdev in the api target_if_nan_set_vdev_feature_config()
before sending vdev set param cmd.

Change-Id: I70ee56ae3c78f466c3757671c95b449925bb9fd2
CRs-Fixed: 3546457
This commit is contained in:
Vijay Raj 2023-07-10 22:32:34 -07:00 committed by Rahul Choudhary
parent de1338a8cf
commit a6753114c3
2 changed files with 8 additions and 11 deletions

View File

@ -518,17 +518,6 @@ target_if_cm_roam_rssi_diff_6ghz(struct wlan_objmgr_vdev *vdev,
}
#endif
/**
* target_if_is_vdev_valid - vdev id is valid or not
* @vdev_id: vdev id
*
* Return: true or false
*/
static bool target_if_is_vdev_valid(uint8_t vdev_id)
{
return (vdev_id < WLAN_MAX_VDEVS ? true : false);
}
/**
* target_if_vdev_set_param() - set per vdev params in fw
* @wmi_handle: wmi handle

View File

@ -26,6 +26,7 @@
#include "nan_ucfg_api.h"
#include "target_if_nan.h"
#include "wlan_nan_api.h"
#include "target_if.h"
#include "wmi_unified_api.h"
#include "scheduler_api.h"
#include <wmi_unified.h>
@ -1164,6 +1165,13 @@ void target_if_nan_set_vdev_feature_config(struct wlan_objmgr_psoc *psoc,
return;
}
if (!target_if_is_vdev_valid(vdev_id)) {
target_if_err("vdev_id: %d is invalid, reject the req: param id %d",
vdev_id,
wmi_vdev_param_enable_disable_nan_config_features);
return;
}
ucfg_get_nan_feature_config(psoc, &nan_features);
target_if_debug("vdev_id:%d NAN features:0x%x", vdev_id, nan_features);