qcacmn: Don't unregister a DDMA module if it was not registered earlier
When we try to unregister a module that was not registered earlier, we will try to unmap the buffers that were not allocated. As a result, we end up with invalid memory access. Fix this issue by checking if the module was registered before unregistering it. Change-Id: I97c4ee7a6690c6cba2a7d1a919a39fcb12ebb692 CRs-Fixed: 3179498
Cette révision appartient à :

révisé par
Madan Koyyalamudi

Parent
36da36e010
révision
d7826cc02e
@@ -1756,6 +1756,8 @@ QDF_STATUS target_if_direct_buf_rx_module_register(
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
direct_buf_rx_err("init dbr ring fail, srng_id %d, status %d",
|
||||
srng_id, status);
|
||||
else
|
||||
mod_param->registered = true;
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2332,6 +2334,13 @@ QDF_STATUS target_if_deinit_dbr_ring(struct wlan_objmgr_pdev *pdev,
|
||||
}
|
||||
direct_buf_rx_debug("mod_param %pK, dbr_ring_cap %pK",
|
||||
mod_param, mod_param->dbr_ring_cap);
|
||||
|
||||
if (!mod_param->registered) {
|
||||
direct_buf_rx_err("module(%d) srng(%d) was not registered",
|
||||
mod_id, srng_id);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
target_if_dbr_deinit_srng(pdev, mod_param);
|
||||
if (mod_param->dbr_ring_cap)
|
||||
qdf_mem_free(mod_param->dbr_ring_cap);
|
||||
@@ -2340,6 +2349,8 @@ QDF_STATUS target_if_deinit_dbr_ring(struct wlan_objmgr_pdev *pdev,
|
||||
qdf_mem_free(mod_param->dbr_ring_cfg);
|
||||
mod_param->dbr_ring_cfg = NULL;
|
||||
|
||||
mod_param->registered = false;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -176,6 +176,8 @@ struct direct_buf_rx_module_debug {
|
||||
* @dbr_ring_cfg: Pointer to direct buf rx ring config struct
|
||||
* @dbr_buf_pool: Pointer to direct buf rx buffer pool struct
|
||||
* @dbr_rsp_handler: Pointer to direct buf rx response handler for the module
|
||||
* @registered: Whether the module @mod_id has successfully registered for this
|
||||
* @pdev_id @srng_id
|
||||
*/
|
||||
struct direct_buf_rx_module_param {
|
||||
enum DBR_MODULE mod_id;
|
||||
@@ -187,6 +189,7 @@ struct direct_buf_rx_module_param {
|
||||
struct direct_buf_rx_buf_info *dbr_buf_pool;
|
||||
bool (*dbr_rsp_handler)(struct wlan_objmgr_pdev *pdev,
|
||||
struct direct_buf_rx_data *dbr_data);
|
||||
bool registered;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur