Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ab3cdc4 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: reqmgr: Hold device lock while retrieving session info



There is a possibility for destroy session and link to occur
concurrently, if this does we end up using a freed pointer while
linking. Avoid this by increasing the scope of the device lock.

Change-Id: I6ffb2d0633455a838cca9194e4717d82a9647183
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent e4bc5ff2
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2432,16 +2432,17 @@ int cam_req_mgr_link(struct cam_req_mgr_link_info *link_info)
		return -EINVAL;
	}

	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->session_hdl);
	if (!cam_session) {
		CAM_DBG(CAM_CRM, "NULL pointer");
		mutex_unlock(&g_crm_core_dev->crm_lock);
		return -EINVAL;
	}

	mutex_lock(&g_crm_core_dev->crm_lock);

	/* Allocate link struct and map it with session's request queue */
	link = __cam_req_mgr_reserve_link(cam_session);
	if (!link) {