mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
qcacmn: Fix memory leaks in scan start and stop requests
-Fix memory leaks in scan start and stop request by freeing the request if posting to scheduler fails. -Populate scan event id based on target. Change-Id: I169c4f3c141dc1af48954788dc74d235afd59c9e CRs-Fixed: 1095299
This commit is contained in:
parent
54c28ccd14
commit
d14a189194
3 changed files with 46 additions and 5 deletions
|
|
@ -29,6 +29,18 @@
|
|||
#include <wlan_scan_tgt_api.h>
|
||||
#include <target_if.h>
|
||||
|
||||
#ifdef CONFIG_MCL
|
||||
inline uint32_t get_scan_event_id(void)
|
||||
{
|
||||
return WMI_SCAN_EVENTID;
|
||||
}
|
||||
#else
|
||||
inline uint32_t get_scan_event_id(void)
|
||||
{
|
||||
return wmi_scan_event_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline struct wlan_lmac_if_scan_rx_ops *
|
||||
target_if_scan_get_rx_ops(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
|
|
@ -85,8 +97,11 @@ target_if_scan_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen)
|
|||
QDF_STATUS
|
||||
target_if_scan_register_event_handler(struct wlan_objmgr_psoc *psoc, void *arg)
|
||||
{
|
||||
uint32_t scan_event_id;
|
||||
|
||||
scan_event_id = get_scan_event_id();
|
||||
return wmi_unified_register_event_handler(psoc->tgt_if_handle,
|
||||
wmi_scan_event_id, target_if_scan_event_handler,
|
||||
scan_event_id, target_if_scan_event_handler,
|
||||
WMI_RX_UMAC_CTX);
|
||||
}
|
||||
|
||||
|
|
@ -94,8 +109,11 @@ QDF_STATUS
|
|||
target_if_scan_unregister_event_handler(struct wlan_objmgr_psoc *psoc,
|
||||
void *arg)
|
||||
{
|
||||
uint32_t scan_event_id;
|
||||
|
||||
scan_event_id = get_scan_event_id();
|
||||
return wmi_unified_unregister_event_handler(psoc->tgt_if_handle,
|
||||
wmi_scan_event_id);
|
||||
scan_event_id);
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ tgt_scan_event_handler(struct wlan_objmgr_psoc *psoc,
|
|||
struct scheduler_msg msg = {0,};
|
||||
struct scan_event *event = &event_info->event;
|
||||
uint8_t vdev_id = event->vdev_id;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!psoc || !event_info) {
|
||||
scm_err("psoc: 0x%p, event_info: 0x%p", psoc, event_info);
|
||||
|
|
@ -177,7 +178,13 @@ tgt_scan_event_handler(struct wlan_objmgr_psoc *psoc,
|
|||
msg.bodyptr = event_info;
|
||||
msg.callback = scm_scan_event_handler;
|
||||
|
||||
return scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &msg);
|
||||
status = scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &msg);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
qdf_mem_free(event_info);
|
||||
wlan_objmgr_vdev_release_ref(event_info->vdev, WLAN_SCAN_ID);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS tgt_scan_bcn_probe_rx_callback(struct wlan_objmgr_psoc *psoc,
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ QDF_STATUS
|
|||
ucfg_scan_start(struct scan_start_request *req)
|
||||
{
|
||||
struct scheduler_msg msg = {0, };
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!req || !req->vdev) {
|
||||
scm_err("vdev: %p, req: %p", req->vdev, req);
|
||||
|
|
@ -123,16 +124,25 @@ ucfg_scan_start(struct scan_start_request *req)
|
|||
msg.bodyptr = req;
|
||||
msg.callback = scm_scan_start_req;
|
||||
|
||||
return scheduler_post_msg(QDF_MODULE_ID_OS_IF, &msg);
|
||||
status = scheduler_post_msg(QDF_MODULE_ID_OS_IF, &msg);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
scm_err("failed to post to QDF_MODULE_ID_OS_IF");
|
||||
qdf_mem_free(req);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
ucfg_scan_cancel(struct scan_cancel_request *req)
|
||||
{
|
||||
struct scheduler_msg msg = {0, };
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!req || !req->vdev) {
|
||||
scm_err("vdev: %p, req: %p", req->vdev, req);
|
||||
if (req)
|
||||
qdf_mem_free(req);
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
scm_info("reqid: %d, scanid: %d, vdevid: %d, type: %d",
|
||||
|
|
@ -141,7 +151,13 @@ ucfg_scan_cancel(struct scan_cancel_request *req)
|
|||
msg.bodyptr = req;
|
||||
msg.callback = scm_scan_cancel_req;
|
||||
|
||||
return scheduler_post_msg(QDF_MODULE_ID_OS_IF, &msg);
|
||||
status = scheduler_post_msg(QDF_MODULE_ID_OS_IF, &msg);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
scm_err("failed to post to QDF_MODULE_ID_OS_IF");
|
||||
qdf_mem_free(req);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
wlan_scan_requester
|
||||
|
|
|
|||
Loading…
Reference in a new issue