msm: camera: cdm: Resolve potential data race condition
Accessing cdm_mgr.nodes.device without holding lock cam_cdm_intf_devices.lock. So added locks before shared variable access to avoid data race conditions. CRs-Fixed: 3372392 Change-Id: If3045410df6ed5a224e62392b5e17d5f45339fa5 Signed-off-by: Dharmender Sharma <quic_dharshar@quicinc.com>
This commit is contained in:
parent
0bb4e4449e
commit
38cae31748
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-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 <linux/delay.h>
|
||||
@ -768,10 +768,12 @@ static void cam_cdm_intf_component_unbind(struct device *dev,
|
||||
CAM_ERR(CAM_CDM, "Valid node present in index=%d", i);
|
||||
goto end;
|
||||
}
|
||||
mutex_destroy(&cdm_mgr.nodes[i].lock);
|
||||
mutex_lock(&cdm_mgr.nodes[i].lock);
|
||||
cdm_mgr.nodes[i].device = NULL;
|
||||
cdm_mgr.nodes[i].data = NULL;
|
||||
cdm_mgr.nodes[i].refcount = 0;
|
||||
mutex_unlock(&cdm_mgr.nodes[i].lock);
|
||||
mutex_destroy(&cdm_mgr.nodes[i].lock);
|
||||
}
|
||||
|
||||
cdm_mgr.probe_done = false;
|
||||
|
Loading…
Reference in New Issue
Block a user