From 217ebc5e61a9968a7596c16cdd3dfcb26f2a6b56 Mon Sep 17 00:00:00 2001 From: Karthik Dillibabu Date: Tue, 9 May 2023 15:55:25 +0530 Subject: [PATCH] msm: camera: core: validation of session/device/link handle This change is to validate session, device and link handle. Also, checks whether the device handle belongs to correct session handle or not. CRs-Fixed: 3496553 Change-Id: I6b86bf7d0908a280e90e085a3b3e1727facdf8c6 Signed-off-by: Karthik Dillibabu --- drivers/cam_req_mgr/cam_req_mgr_core.c | 70 ++++++--------- drivers/cam_req_mgr/cam_req_mgr_util.c | 115 +++++++++++++++++++++---- drivers/cam_req_mgr/cam_req_mgr_util.h | 55 ++++++++++-- 3 files changed, 177 insertions(+), 63 deletions(-) diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index 5f6f3ae3e8b0..887bdce34744 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -3164,9 +3164,7 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req) return -EINVAL; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(add_req->link_hdl); - + link = cam_get_link_priv(add_req->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", add_req->link_hdl); return -EINVAL; @@ -3253,8 +3251,7 @@ static int cam_req_mgr_cb_notify_err( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(err_info->link_hdl); + link = cam_get_link_priv(err_info->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", err_info->link_hdl); rc = -EINVAL; @@ -3351,8 +3348,7 @@ static int cam_req_mgr_cb_notify_timer( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(timer_data->link_hdl); + link = cam_get_link_priv(timer_data->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", timer_data->link_hdl); rc = -EINVAL; @@ -3406,8 +3402,7 @@ static int cam_req_mgr_cb_notify_stop( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(stop_info->link_hdl); + link = cam_get_link_priv(stop_info->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", stop_info->link_hdl); rc = -EINVAL; @@ -3470,8 +3465,7 @@ static int cam_req_mgr_cb_notify_trigger( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(trigger_data->link_hdl); + link = cam_get_link_priv(trigger_data->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", trigger_data->link_hdl); rc = -EINVAL; @@ -3851,7 +3845,7 @@ static int __cam_req_mgr_unlink( __cam_req_mgr_destroy_subdev(&link->l_dev); /* Destroy the link handle */ - rc = cam_destroy_device_hdl(link->link_hdl); + rc = cam_destroy_link_hdl(link->link_hdl); if (rc < 0) { CAM_ERR(CAM_CRM, "error destroying link hdl %x rc %d", link->link_hdl, rc); @@ -3877,8 +3871,7 @@ int cam_req_mgr_destroy_session( } mutex_lock(&g_crm_core_dev->crm_lock); - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(ses_info->session_hdl); + cam_session = cam_get_session_priv(ses_info->session_hdl); if (!cam_session || (cam_session->session_hdl != ses_info->session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, ses_info->ses_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(cam_session), ses_info->session_hdl, @@ -3950,8 +3943,7 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(link_info->u.link_info_v1.session_hdl); + cam_session = cam_get_session_priv(link_info->u.link_info_v1.session_hdl); if (!cam_session || (cam_session->session_hdl != link_info->u.link_info_v1.session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, link_info->ses_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(cam_session), link_info->u.link_info_v1.session_hdl, @@ -3974,8 +3966,8 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) root_dev.priv = (void *)link; root_dev.dev_id = CAM_CRM; mutex_lock(&link->lock); - /* Create unique dev handle for link */ - link->link_hdl = cam_create_device_hdl(&root_dev); + /* Create unique handle for link */ + link->link_hdl = cam_create_link_hdl(&root_dev); if (link->link_hdl < 0) { CAM_ERR(CAM_CRM, "Insufficient memory to create new device handle"); @@ -4030,7 +4022,7 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) setup_failed: __cam_req_mgr_destroy_subdev(&link->l_dev); create_subdev_failed: - cam_destroy_device_hdl(link->link_hdl); + cam_destroy_link_hdl(link->link_hdl); link_info->u.link_info_v1.link_hdl = -1; link_hdl_fail: mutex_unlock(&link->lock); @@ -4062,8 +4054,7 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(link_info->u.link_info_v2.session_hdl); + cam_session = cam_get_session_priv(link_info->u.link_info_v2.session_hdl); if (!cam_session || (cam_session->session_hdl != link_info->u.link_info_v2.session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, link_info->ses_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(cam_session), link_info->u.link_info_v2.session_hdl, @@ -4087,8 +4078,8 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) root_dev.dev_id = CAM_CRM; mutex_lock(&link->lock); - /* Create unique dev handle for link */ - link->link_hdl = cam_create_device_hdl(&root_dev); + /* Create unique handle for link */ + link->link_hdl = cam_create_link_hdl(&root_dev); if (link->link_hdl < 0) { CAM_ERR(CAM_CRM, "Insufficient memory to create new device handle"); @@ -4148,7 +4139,7 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) setup_failed: __cam_req_mgr_destroy_subdev(&link->l_dev); create_subdev_failed: - cam_destroy_device_hdl(link->link_hdl); + cam_destroy_link_hdl(link->link_hdl); link_info->u.link_info_v2.link_hdl = -1; link_hdl_fail: mutex_unlock(&link->lock); @@ -4173,8 +4164,7 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info) CAM_DBG(CAM_CRM, "link_hdl %x", unlink_info->link_hdl); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(unlink_info->session_hdl); + cam_session = cam_get_session_priv(unlink_info->session_hdl); if (!cam_session || (cam_session->session_hdl != unlink_info->session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, unlink_info->ses_hdl:%x, cam_session->ses_hdl:%x", CAM_IS_NULL_TO_STR(cam_session), unlink_info->session_hdl, @@ -4184,7 +4174,7 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info) } /* link hdl's priv data is core_link struct */ - link = cam_get_device_priv(unlink_info->link_hdl); + link = cam_get_link_priv(unlink_info->link_hdl); if (!link || (link->link_hdl != unlink_info->link_hdl)) { CAM_ERR(CAM_CRM, "link: %s, unlink_info->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), unlink_info->link_hdl, @@ -4219,8 +4209,7 @@ int cam_req_mgr_schedule_request( } mutex_lock(&g_crm_core_dev->crm_lock); - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(sched_req->link_hdl); + link = cam_get_link_priv(sched_req->link_hdl); if (!link || (link->link_hdl != sched_req->link_hdl)) { CAM_ERR(CAM_CRM, "link: %s, sched_req->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), sched_req->link_hdl, @@ -4306,8 +4295,7 @@ int cam_req_mgr_sync_config( mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(sync_info->session_hdl); + cam_session = cam_get_session_priv(sync_info->session_hdl); if (!cam_session || (cam_session->session_hdl != sync_info->session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, sync_info->session_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(cam_session), sync_info->session_hdl, @@ -4326,7 +4314,7 @@ int cam_req_mgr_sync_config( goto done; } - link[i] = cam_get_device_priv(sync_info->link_hdls[i]); + link[i] = cam_get_link_priv(sync_info->link_hdls[i]); if (!link[i] || (link[i]->link_hdl != sync_info->link_hdls[i])) { CAM_ERR(CAM_CRM, "link: %s, sync_info->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), sync_info->link_hdls[i], @@ -4403,9 +4391,9 @@ int cam_req_mgr_flush_requests( } mutex_lock(&g_crm_core_dev->crm_lock); + /* session hdl's priv data is cam session struct */ - session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(flush_info->session_hdl); + session = cam_get_session_priv(flush_info->session_hdl); if (!session || (session->session_hdl != flush_info->session_hdl)) { CAM_ERR(CAM_CRM, "session: %s, flush_info->ses_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(session), flush_info->session_hdl, @@ -4419,8 +4407,7 @@ int cam_req_mgr_flush_requests( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(flush_info->link_hdl); + link = cam_get_link_priv(flush_info->link_hdl); if (!link || (link->link_hdl != flush_info->link_hdl)) { CAM_ERR(CAM_CRM, "link: %s, flush_info->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), flush_info->link_hdl, @@ -4480,8 +4467,7 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control) mutex_lock(&g_crm_core_dev->crm_lock); for (i = 0; i < control->num_links; i++) { - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(control->link_hdls[i]); + link = cam_get_link_priv(control->link_hdls[i]); if (!link || (link->link_hdl != control->link_hdls[i])) { CAM_ERR(CAM_CRM, "link: %s, control->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), control->link_hdls[i], @@ -4569,8 +4555,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(dump_req->session_handle); + session = cam_get_session_priv(dump_req->session_handle); if (!session || (session->session_hdl != dump_req->session_handle)) { CAM_ERR(CAM_CRM, "session: %s, dump_req->ses_hdl:%x, session->ses_hdl:%x", CAM_IS_NULL_TO_STR(session), dump_req->session_handle, @@ -4584,8 +4569,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req) goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(dump_req->link_hdl); + link = cam_get_link_priv(dump_req->link_hdl); if (!link || (link->link_hdl != dump_req->link_hdl)) { CAM_ERR(CAM_CRM, "link: %s, dump_req->link_hdl:%x, link->link_hdl:%x", CAM_IS_NULL_TO_STR(link), dump_req->link_hdl, diff --git a/drivers/cam_req_mgr/cam_req_mgr_util.c b/drivers/cam_req_mgr/cam_req_mgr_util.c index 3c44058d2813..2be1ce7cfec2 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_util.c +++ b/drivers/cam_req_mgr/cam_req_mgr_util.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #define pr_fmt(fmt) "CAM-REQ-MGR_UTIL %s:%d " fmt, __func__, __LINE__ @@ -37,28 +38,29 @@ int cam_req_mgr_util_init(void) rc = -ENOMEM; goto hdl_tbl_alloc_failed; } + bitmap_size = BITS_TO_LONGS(CAM_REQ_MGR_MAX_HANDLES_V2) * sizeof(long); + hdl_tbl_local->bitmap = kzalloc(bitmap_size, GFP_KERNEL); + if (!hdl_tbl_local->bitmap) { + rc = -ENOMEM; + goto bitmap_alloc_fail; + } + hdl_tbl_local->bits = bitmap_size * BITS_PER_BYTE; + spin_lock_bh(&hdl_tbl_lock); if (hdl_tbl) { spin_unlock_bh(&hdl_tbl_lock); rc = -EEXIST; + kfree(hdl_tbl_local->bitmap); kfree(hdl_tbl_local); goto hdl_tbl_check_failed; } hdl_tbl = hdl_tbl_local; spin_unlock_bh(&hdl_tbl_lock); - bitmap_size = BITS_TO_LONGS(CAM_REQ_MGR_MAX_HANDLES_V2) * sizeof(long); - hdl_tbl->bitmap = kzalloc(bitmap_size, GFP_KERNEL); - if (!hdl_tbl->bitmap) { - rc = -ENOMEM; - goto bitmap_alloc_fail; - } - hdl_tbl->bits = bitmap_size * BITS_PER_BYTE; - return rc; bitmap_alloc_fail: - kfree(hdl_tbl); + kfree(hdl_tbl_local); hdl_tbl = NULL; hdl_tbl_alloc_failed: hdl_tbl_check_failed: @@ -125,6 +127,18 @@ static int32_t cam_get_free_handle_index(void) return idx; } +static void cam_dump_tbl_info(void) +{ + int i; + + for (i = 0; i < CAM_REQ_MGR_MAX_HANDLES_V2; i++) + CAM_INFO_RATE_LIMIT_CUSTOM(CAM_CRM, CAM_RATE_LIMIT_INTERVAL_5SEC, + CAM_REQ_MGR_MAX_HANDLES_V2, + "session_hdl=%x hdl_value=%x type=%d state=%d dev_id=%lld", + hdl_tbl->hdl[i].session_hdl, hdl_tbl->hdl[i].hdl_value, + hdl_tbl->hdl[i].type, hdl_tbl->hdl[i].state, hdl_tbl->hdl[i].dev_id); +} + int32_t cam_create_session_hdl(void *priv) { int idx; @@ -140,7 +154,8 @@ int32_t cam_create_session_hdl(void *priv) idx = cam_get_free_handle_index(); if (idx < 0) { - CAM_ERR(CAM_CRM, "Unable to create session handle"); + CAM_ERR(CAM_CRM, "Unable to create session handle(idx = %d)", idx); + cam_dump_tbl_info(); spin_unlock_bh(&hdl_tbl_lock); return idx; } @@ -182,8 +197,8 @@ int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data) idx = cam_get_free_handle_index(); if (idx < 0) { - CAM_ERR(CAM_CRM, - "Unable to create device handle(idx= %d)", idx); + CAM_ERR(CAM_CRM, "Unable to create device handle(idx= %d)", idx); + cam_dump_tbl_info(); spin_unlock_bh(&hdl_tbl_lock); return idx; } @@ -233,7 +248,43 @@ uint64_t cam_get_dev_handle_status(void) return active_dev_hdls; } -void *cam_get_device_priv(int32_t dev_hdl) +int32_t cam_create_link_hdl(struct cam_create_dev_hdl *hdl_data) +{ + int idx; + int rand = 0; + int32_t handle; + + spin_lock_bh(&hdl_tbl_lock); + if (!hdl_tbl) { + CAM_ERR(CAM_CRM, "Hdl tbl is NULL"); + spin_unlock_bh(&hdl_tbl_lock); + return -EINVAL; + } + + idx = cam_get_free_handle_index(); + if (idx < 0) { + CAM_ERR(CAM_CRM, "Unable to create link handle(idx = %d)", idx); + cam_dump_tbl_info(); + spin_unlock_bh(&hdl_tbl_lock); + return idx; + } + + get_random_bytes(&rand, CAM_REQ_MGR_RND1_BYTES); + handle = GET_DEV_HANDLE(rand, HDL_TYPE_LINK, idx); + hdl_tbl->hdl[idx].session_hdl = hdl_data->session_hdl; + hdl_tbl->hdl[idx].hdl_value = handle; + hdl_tbl->hdl[idx].type = HDL_TYPE_LINK; + hdl_tbl->hdl[idx].state = HDL_ACTIVE; + hdl_tbl->hdl[idx].priv = hdl_data->priv; + hdl_tbl->hdl[idx].ops = NULL; + hdl_tbl->hdl[idx].dev_id = hdl_data->dev_id; + spin_unlock_bh(&hdl_tbl_lock); + + CAM_DBG(CAM_CRM, "handle = %x", handle); + return handle; +} + +void *cam_get_priv(int32_t dev_hdl, int handle_type) { int idx; int type; @@ -264,7 +315,7 @@ void *cam_get_device_priv(int32_t dev_hdl) } type = CAM_REQ_MGR_GET_HDL_TYPE(dev_hdl); - if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type) { + if (type != handle_type) { CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid type:%d", type); goto device_priv_fail; } @@ -279,6 +330,34 @@ device_priv_fail: return NULL; } +void *cam_get_device_priv(int32_t dev_hdl) +{ + void *priv; + + priv = cam_get_priv(dev_hdl, HDL_TYPE_DEV); + return priv; +} + +struct cam_req_mgr_core_session *cam_get_session_priv(int32_t dev_hdl) +{ + struct cam_req_mgr_core_session *priv; + + priv = (struct cam_req_mgr_core_session *) + cam_get_priv(dev_hdl, HDL_TYPE_SESSION); + + return priv; +} + +struct cam_req_mgr_core_link *cam_get_link_priv(int32_t dev_hdl) +{ + struct cam_req_mgr_core_link *priv; + + priv = (struct cam_req_mgr_core_link *) + cam_get_priv(dev_hdl, HDL_TYPE_LINK); + + return priv; +} + void *cam_get_device_ops(int32_t dev_hdl) { int idx; @@ -303,7 +382,7 @@ void *cam_get_device_ops(int32_t dev_hdl) } type = CAM_REQ_MGR_GET_HDL_TYPE(dev_hdl); - if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type) { + if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type && HDL_TYPE_LINK != type) { CAM_ERR(CAM_CRM, "Invalid type"); goto device_ops_fail; } @@ -374,6 +453,12 @@ int cam_destroy_device_hdl(int32_t dev_hdl) return cam_destroy_hdl(dev_hdl, HDL_TYPE_DEV); } +int cam_destroy_link_hdl(int32_t dev_hdl) +{ + CAM_DBG(CAM_CRM, "handle = %x", dev_hdl); + return cam_destroy_hdl(dev_hdl, HDL_TYPE_LINK); +} + int cam_destroy_session_hdl(int32_t dev_hdl) { return cam_destroy_hdl(dev_hdl, HDL_TYPE_SESSION); diff --git a/drivers/cam_req_mgr/cam_req_mgr_util.h b/drivers/cam_req_mgr/cam_req_mgr_util.h index fb70401306d9..68671b7cf7bc 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_util.h +++ b/drivers/cam_req_mgr/cam_req_mgr_util.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef _CAM_REQ_MGR_UTIL_API_H_ @@ -9,6 +10,9 @@ #include #include "cam_req_mgr_util_priv.h" +/* Interval for cam_info_rate_limit_custom() */ +#define CAM_RATE_LIMIT_INTERVAL_5SEC 5 + /** * state of a handle(session/device) * @HDL_FREE: free handle @@ -21,12 +25,14 @@ enum hdl_state { /** * handle type - * @HDL_TYPE_DEV: for device and link + * @HDL_TYPE_DEV: for device * @HDL_TYPE_SESSION: for session + * @HDL_TYPE_LINK: for link */ enum hdl_type { HDL_TYPE_DEV = 1, - HDL_TYPE_SESSION + HDL_TYPE_SESSION, + HDL_TYPE_LINK }; /** @@ -103,8 +109,19 @@ int32_t cam_create_session_hdl(void *priv); int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data); /** - * cam_get_device_priv() - get private data of a handle - * @dev_hdl: handle for a session/link/device + * cam_create_link_hdl() - create a link handle + * @hdl_data: session hdl, flags, ops and priv dara as input + * + * cam_req_mgr_core calls this function to get + * session and link handles + * KMD drivers calls this function to create + * a link handle. Returns a unique link handle + */ +int32_t cam_create_link_hdl(struct cam_create_dev_hdl *hdl_data); + +/** + * cam_get_device_priv() - get private data of a device handle + * @dev_hdl: handle for a device * * cam_req_mgr_core and KMD drivers use this function to * get private data of a handle. Returns a private data @@ -112,6 +129,26 @@ int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data); */ void *cam_get_device_priv(int32_t dev_hdl); +/** + * cam_get_session_priv() - get private data of a session handle + * @dev_hdl: handle for a session + * + * cam_req_mgr_core and KMD drivers use this function to + * get private data of a handle. Returns a private data + * structure pointer. + */ +struct cam_req_mgr_core_session *cam_get_session_priv(int32_t dev_hdl); + +/** + * cam_get_link_priv() - get private data of a link handle + * @dev_hdl: handle for a link + * + * cam_req_mgr_core and KMD drivers use this function to + * get private data of a handle. Returns a private data + * structure pointer. + */ +struct cam_req_mgr_core_link *cam_get_link_priv(int32_t dev_hdl); + /** * cam_get_device_ops() - get ops of a handle * @dev_hdl: handle for a session/link/device @@ -123,12 +160,20 @@ void *cam_get_device_ops(int32_t dev_hdl); /** * cam_destroy_device_hdl() - destroy device handle - * @dev_hdl: handle for a link/device. + * @dev_hdl: handle for a device. * * Returns success/failure */ int32_t cam_destroy_device_hdl(int32_t dev_hdl); +/** + * cam_destroy_link_hdl() - destroy link handle + * @dev_hdl: handle for a link. + * + * Returns success/failure + */ +int32_t cam_destroy_link_hdl(int32_t dev_hdl); + /** * cam_destroy_session_hdl() - destroy device handle * @dev_hdl: handle for a session