diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..dde8122
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/display-commonsys
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..ad6d5eb
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,5 @@
+soong_namespace {
+    imports: [
+        "vendor/qcom/opensource/commonsys-intf/display"
+    ],
+}
diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp
index 2361ab0..b0da5a8 100644
--- a/services/config/src/device_impl.cpp
+++ b/services/config/src/device_impl.cpp
@@ -30,7 +30,7 @@
 /*
  * Changes from Qualcomm Innovation Center are provided under the following license:
  *
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted (subject to the limitations in the
@@ -82,6 +82,7 @@
       return -1;
     }
 
+    device_obj_->intf_ = intf;
     android::status_t status = device_obj_->IDisplayConfig::registerAsService();
     // Unable to start Display Config 2.0 service. Fail Init.
     if (status != android::OK) {
@@ -89,7 +90,6 @@
       device_obj_ = nullptr;
       return -1;
     }
-    device_obj_->intf_ = intf;
   }
 
   return 0;
@@ -147,6 +147,7 @@
 
 void DeviceImpl::serviceDied(uint64_t client_handle,
                              const android::wp<::android::hidl::base::V1_0::IBase>& callback) {
+  std::lock_guard<std::shared_mutex> exclusive_lock(shared_mutex_);
   std::lock_guard<std::recursive_mutex> lock(death_service_mutex_);
   auto itr = display_config_map_.find(client_handle);
   std::shared_ptr<DeviceClientContext> client = itr->second;
@@ -233,6 +234,10 @@
   bool connected = false;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(DisplayType)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   dpy = reinterpret_cast<const DisplayType*>(data);
   int32_t error = intf_->IsDisplayConnected(*dpy, &connected);
@@ -246,6 +251,11 @@
                                                             perform_cb _hidl_cb) {
   const struct StatusParams *display_status;
   const uint8_t *data = input_params.data();
+
+  if (input_params.size() != sizeof(StatusParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   display_status = reinterpret_cast<const StatusParams*>(data);
   int32_t error = intf_->SetDisplayStatus(display_status->dpy,
                                           display_status->status);
@@ -256,6 +266,11 @@
                                                                    perform_cb _hidl_cb) {
   const struct DynRefreshRateParams *dyn_refresh_data;
   const uint8_t *data = input_params.data();
+
+  if (input_params.size() != sizeof(DynRefreshRateParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   dyn_refresh_data = reinterpret_cast<const DynRefreshRateParams*>(data);
   int32_t error = intf_->ConfigureDynRefreshRate(dyn_refresh_data->op,
                                                  dyn_refresh_data->refresh_rate);
@@ -273,6 +288,10 @@
     return;
   }
 
+  if (input_params.size() != sizeof(DisplayType)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   dpy = reinterpret_cast<const DisplayType*>(data);
   int32_t error = intf_->GetConfigCount(*dpy, &count);
@@ -287,6 +306,10 @@
   uint32_t config = 0;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(DisplayType)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   dpy = reinterpret_cast<const DisplayType*>(data);
   int32_t error = intf_->GetActiveConfig(*dpy, &config);
@@ -299,6 +322,10 @@
                                                            perform_cb _hidl_cb) {
   const struct ConfigParams *set_active_cfg_data;
 
+  if (input_params.size() != sizeof(ConfigParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   set_active_cfg_data = reinterpret_cast<const ConfigParams*>(data);
   int32_t error = intf_->SetActiveConfig(set_active_cfg_data->dpy,
@@ -313,6 +340,10 @@
   ByteStream output_params;
   int32_t error = -EINVAL;
 
+  if (input_params.size() != sizeof(AttributesParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   get_disp_attr_data = reinterpret_cast<const AttributesParams*>(data);
   error = intf_->GetDisplayAttributes(get_disp_attr_data->config_index, get_disp_attr_data->dpy,
@@ -327,6 +358,10 @@
   const uint32_t *level;
   int32_t error = 0;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   level = reinterpret_cast<const uint32_t*>(data);
   error = intf_->SetPanelBrightness(*level);
@@ -352,6 +387,10 @@
   const struct MinHdcpEncLevelChangedParams *min_hdcp_enc_level_data;
   int32_t error = 0;
 
+  if (input_params.size() != sizeof(MinHdcpEncLevelChangedParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   min_hdcp_enc_level_data = reinterpret_cast<const MinHdcpEncLevelChangedParams*>(data);
   error = intf_->MinHdcpEncryptionLevelChanged(min_hdcp_enc_level_data->dpy,
@@ -370,6 +409,10 @@
   const struct PartialUpdateParams *partial_update_data;
   int32_t error = 0;
 
+  if (input_params.size() != sizeof(PartialUpdateParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   partial_update_data = reinterpret_cast<const PartialUpdateParams*>(data);
   error = intf_->ControlPartialUpdate(partial_update_data->dpy, partial_update_data->enable);
@@ -382,6 +425,10 @@
   const bool *on;
   int32_t error = 0;
 
+  if (input_params.size() != sizeof(bool)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   on = reinterpret_cast<const bool*>(data);
   error = intf_->ToggleScreenUpdate(on);
@@ -393,6 +440,10 @@
                                                           perform_cb _hidl_cb) {
   const uint32_t *timeout_value;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   timeout_value = reinterpret_cast<const uint32_t*>(data);
   int32_t error = intf_->SetIdleTimeout(*timeout_value);
@@ -408,6 +459,10 @@
   int32_t *data_output;
   int32_t error = -EINVAL;
 
+  if (input_params.size() != sizeof(DisplayType)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   dpy = reinterpret_cast<const DisplayType*>(data);
   error = intf_->GetHDRCapabilities(*dpy, &hdr_caps);
@@ -437,6 +492,10 @@
                                                                  perform_cb _hidl_cb) {
   const uint32_t *launch_status_data;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   launch_status_data = reinterpret_cast<const uint32_t*>(data);
 
@@ -449,6 +508,10 @@
                                                            perform_cb _hidl_cb) {
   const CameraSmoothInfo *camera_info;
 
+  if (input_params.size() != sizeof(CameraSmoothInfo)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   camera_info = reinterpret_cast<const CameraSmoothInfo*>(data);
   int32_t error = intf_->SetCameraSmoothInfo(camera_info->op, camera_info->fps);
@@ -459,6 +522,10 @@
                                                                 perform_cb _hidl_cb) {
   const bool *enable;
 
+  if (input_params.size() != sizeof(bool)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   enable = reinterpret_cast<const bool*>(data);
 
@@ -482,6 +549,10 @@
                                                                perform_cb _hidl_cb) {
   const struct AnimationParams *display_animating_data;
 
+  if (input_params.size() != sizeof(AnimationParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   display_animating_data = reinterpret_cast<const AnimationParams*>(data);
   int32_t error = intf_->SetDisplayAnimating(display_animating_data->display_id,
@@ -494,6 +565,10 @@
                                                                     perform_cb _hidl_cb) {
   const struct IdlePcParams *idle_pc_data;
 
+  if (input_params.size() != sizeof(IdlePcParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   idle_pc_data = reinterpret_cast<const IdlePcParams*>(data);
   int32_t error = intf_->ControlIdlePowerCollapse(idle_pc_data->enable, idle_pc_data->synchronous);
@@ -515,6 +590,10 @@
                                                                perform_cb _hidl_cb) {
   const struct DppsAdRoiParams *ad_roi_data;
 
+  if (input_params.size() != sizeof(DppsAdRoiParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   ad_roi_data = reinterpret_cast<const DppsAdRoiParams*>(data);
 
@@ -540,6 +619,10 @@
                                                         perform_cb _hidl_cb) {
   const struct PowerModeParams *set_power_mode_data;
 
+  if (input_params.size() != sizeof(PowerModeParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   set_power_mode_data = reinterpret_cast<const PowerModeParams*>(data);
   int32_t error = intf_->SetPowerMode(set_power_mode_data->disp_id,
@@ -550,6 +633,10 @@
 void DeviceImpl::DeviceClientContext::ParseIsPowerModeOverrideSupported(
                                       const ByteStream &input_params,
                                       perform_cb _hidl_cb) {
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
   bool supported = false;
@@ -563,6 +650,10 @@
 
 void DeviceImpl::DeviceClientContext::ParseIsHdrSupported(const ByteStream &input_params,
                                                           perform_cb _hidl_cb) {
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
   bool supported = false;
@@ -576,6 +667,10 @@
 
 void DeviceImpl::DeviceClientContext::ParseIsWcgSupported(const ByteStream &input_params,
                                                           perform_cb _hidl_cb) {
+  if (input_params.size() != sizeof(int32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const int32_t *disp_id = reinterpret_cast<const int32_t*>(data);
   bool supported = false;
@@ -591,6 +686,10 @@
                                                           perform_cb _hidl_cb) {
   const struct LayerMaskParams *layer_mask_data;
 
+  if (input_params.size() != sizeof(LayerMaskParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   layer_mask_data = reinterpret_cast<const LayerMaskParams*>(data);
   int32_t error = intf_->SetLayerAsMask(layer_mask_data->disp_id, layer_mask_data->layer_id);
@@ -603,6 +702,10 @@
   std::string value;
   ByteStream output_params;
 
+  if (input_params.size() == 0) {
+    _hidl_cb(-ENODATA, {}, {});
+     return;
+  }
   const uint8_t *data = input_params.data();
   const char *name = reinterpret_cast<const char *>(data);
   std::string prop_name(name);
@@ -630,6 +733,10 @@
                                       perform_cb _hidl_cb) {
   const struct PanelLumAttrParams *panel_lum_attr_data;
 
+  if (input_params.size() != sizeof(PanelLumAttrParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   panel_lum_attr_data = reinterpret_cast<const PanelLumAttrParams*>(data);
   int32_t error = intf_->SetPanelLuminanceAttributes(panel_lum_attr_data->disp_id,
@@ -645,6 +752,10 @@
   bool is_builtin = false;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   disp_id = reinterpret_cast<const uint32_t*>(data);
   int32_t error = intf_->IsBuiltInDisplay(*disp_id, &is_builtin);
@@ -660,6 +771,10 @@
                                                               perform_cb _hidl_cb) {
   const struct CwbBufferParams *cwb_buffer_data;
 
+  if (input_params.size() != sizeof(CwbBufferParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   cwb_buffer_data = reinterpret_cast<const CwbBufferParams*>(data);
   hidl_handle buffer = input_handles[0];
@@ -682,6 +797,10 @@
   std::vector<uint64_t> bit_clks;
   uint64_t *bit_clks_data;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   disp_id = reinterpret_cast<const uint32_t*>(data);
   int32_t error = intf_->GetSupportedDSIBitClks(*disp_id, &bit_clks);
@@ -705,6 +824,10 @@
   uint64_t bit_clk = 0;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   disp_id = reinterpret_cast<const uint32_t*>(data);
   int32_t error = intf_->GetDSIClk(*disp_id, &bit_clk);
@@ -718,6 +841,10 @@
                                                      perform_cb _hidl_cb) {
   const struct DsiClkParams *set_dsi_clk_data;
 
+  if (input_params.size() != sizeof(DsiClkParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   set_dsi_clk_data = reinterpret_cast<const DsiClkParams*>(data);
   int32_t error = intf_->SetDSIClk(set_dsi_clk_data->disp_id, set_dsi_clk_data->bit_clk);
@@ -728,6 +855,10 @@
                                                         perform_cb _hidl_cb) {
   const struct QsyncModeParams *set_qsync_mode_data;
 
+  if (input_params.size() != sizeof(QsyncModeParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   set_qsync_mode_data = reinterpret_cast<const QsyncModeParams*>(data);
   int32_t error = intf_->SetQsyncMode(set_qsync_mode_data->disp_id, set_qsync_mode_data->mode);
@@ -740,6 +871,10 @@
   bool is_smart = false;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(SmartPanelCfgParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   smart_panel_cfg_data = reinterpret_cast<const SmartPanelCfgParams*>(data);
   int32_t error = intf_->IsSmartPanelConfig(smart_panel_cfg_data->disp_id,
@@ -764,6 +899,10 @@
                                                                 perform_cb _hidl_cb) {
   const struct VdsParams *vds_input_data;
 
+  if (input_params.size() != sizeof(VdsParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   vds_input_data = reinterpret_cast<const VdsParams*>(data);
 
@@ -779,6 +918,10 @@
   bool supported = false;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(RotatorFormatParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   input_data = reinterpret_cast<const RotatorFormatParams*>(data);
   int32_t error = intf_->IsRotatorSupportedFormat(input_data->hal_format, input_data->ubwc,
@@ -794,6 +937,10 @@
                                                                 perform_cb _hidl_cb) {
   const bool *enable;
 
+  if (input_params.size() != sizeof(bool)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   enable = reinterpret_cast<const bool*>(data);
 
@@ -807,6 +954,10 @@
                                                                      perform_cb _hidl_cb) {
   const bool *enable;
 
+  if (input_params.size() != sizeof(bool)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   enable = reinterpret_cast<const bool*>(data);
 
@@ -820,6 +971,10 @@
   const struct TUIEventParams *input_data =
                reinterpret_cast<const TUIEventParams*>(input_params.data());
 
+  if (input_params.size() != sizeof(TUIEventParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   int32_t error = intf_->SendTUIEvent(input_data->dpy, input_data->tui_event_type);
 
   _hidl_cb(error, {}, {});
@@ -851,6 +1006,10 @@
   uint32_t disp_hw_id = 0;
   ByteStream output_params;
 
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
   int32_t error = intf_->GetDisplayHwId(*disp_id, &disp_hw_id);
@@ -864,6 +1023,10 @@
   ByteStream output_params;
   std::vector<uint32_t> refresh_rates;
 
+  if (input_params.size() != sizeof(DisplayType)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const DisplayType *dpy = reinterpret_cast<const DisplayType *>(data);
   int32_t error = intf_->GetSupportedDisplayRefreshRates(*dpy, &refresh_rates);
@@ -885,6 +1048,11 @@
 void DeviceImpl::DeviceClientContext::ParseIsRCSupported(const ByteStream &input_params,
                                                          perform_cb _hidl_cb) {
   const uint8_t *data = input_params.data();
+
+  if (input_params.size() != sizeof(uint32_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint32_t *disp_id = reinterpret_cast<const uint32_t*>(data);
   bool supported = false;
   int32_t error = intf_->IsRCSupported(*disp_id, &supported);
@@ -902,6 +1070,11 @@
   }
 
   const struct SupportedModesParams *supported_modes_data;
+
+  if (input_params.size() != sizeof(SupportedModesParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   bool supported = false;
   ByteStream output_params;
@@ -915,6 +1088,10 @@
 
 void DeviceImpl::DeviceClientContext::ParseGetDisplayType(const ByteStream &input_params,
                                                           perform_cb _hidl_cb) {
+  if (input_params.size() != sizeof(uint64_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   const uint64_t *physical_disp_id = reinterpret_cast<const uint64_t*>(data);
   DisplayType disp_type = DisplayConfig::DisplayType::kInvalid;
@@ -932,6 +1109,10 @@
 
 void DeviceImpl::DeviceClientContext::ParseGetDisplayTileCount(const ByteStream &input_params,
                                                                perform_cb _hidl_cb) {
+  if (input_params.size() != sizeof(uint64_t)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint64_t *data = reinterpret_cast<const uint64_t*>(input_params.data());
   uint64_t physical_disp_id = data ? *data : 0;
   uint32_t num_tiles[2] = {0, 0};
@@ -948,6 +1129,10 @@
                                                              perform_cb _hidl_cb) {
   struct PowerModeTiledParams set_power_mode_tiled_data = {};
 
+  if (input_params.size() != sizeof(PowerModeTiledParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   if (data) {
     set_power_mode_tiled_data = *reinterpret_cast<const PowerModeTiledParams*>(data);
@@ -963,6 +1148,10 @@
                                                                    perform_cb _hidl_cb) {
   struct PanelBrightnessTiledParams set_panel_brightness_tiled_data = {};
 
+  if (input_params.size() != sizeof(PanelBrightnessTiledParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   if (data) {
     set_panel_brightness_tiled_data = *reinterpret_cast<const PanelBrightnessTiledParams*>(data);
@@ -978,6 +1167,10 @@
                                                                   perform_cb _hidl_cb) {
   struct WiderModePrefParams set_wider_mode_pref_data = {};
 
+  if (input_params.size() != sizeof(WiderModePrefParams)) {
+    _hidl_cb(-ENODATA, {}, {});
+    return;
+  }
   const uint8_t *data = input_params.data();
   if (data) {
     set_wider_mode_pref_data = *reinterpret_cast<const WiderModePrefParams*>(data);
@@ -990,16 +1183,21 @@
 Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
                                  const ByteStream &input_params, const HandleStream &input_handles,
                                  perform_cb _hidl_cb) {
+  std::shared_lock<std::shared_mutex> shared_lock(shared_mutex_);
   int32_t error = 0;
-  std::lock_guard<std::recursive_mutex> lock(death_service_mutex_);
-  auto itr = display_config_map_.find(client_handle);
-  if (itr == display_config_map_.end()) {
-    error = -EINVAL;
-    _hidl_cb(error, {}, {});
-    return Void();
+  std::shared_ptr<DeviceClientContext> client = nullptr;
+
+  {
+    std::lock_guard<std::recursive_mutex> lock(death_service_mutex_);
+    auto itr = display_config_map_.find(client_handle);
+    if (itr == display_config_map_.end()) {
+      error = -EINVAL;
+      _hidl_cb(error, {}, {});
+      return Void();
+    }
+    client = itr->second;
   }
 
-  std::shared_ptr<DeviceClientContext> client = itr->second;
   if (!client) {
     error = -EINVAL;
     _hidl_cb(error, {}, {});
diff --git a/services/config/src/device_impl.h b/services/config/src/device_impl.h
index cf60366..3433d05 100644
--- a/services/config/src/device_impl.h
+++ b/services/config/src/device_impl.h
@@ -74,6 +74,7 @@
 #include <utility>
 #include <string>
 #include <vector>
+#include <shared_mutex>
 
 #include "opcode_types.h"
 
@@ -187,6 +188,7 @@
   std::map<uint64_t, std::shared_ptr<DeviceClientContext>> display_config_map_;
   uint64_t client_id_ = 0;
   std::recursive_mutex death_service_mutex_;
+  std::shared_mutex shared_mutex_;
   static DeviceImpl *device_obj_;
   static std::mutex device_lock_;
 };
