sdm: Validate connector modes again
Mode index validation required each time when we get
connecotor info as hotplug disconnect can clear the
modes listed on crtc.
Change-Id: Ibe3f64e8ceb5e3cb11c56f06256c7e71eb5ec220
CRs-fixed: 2110309
diff --git a/sdm/libs/core/drm/hw_tv_drm.cpp b/sdm/libs/core/drm/hw_tv_drm.cpp
index d19b706..0b9bd92 100644
--- a/sdm/libs/core/drm/hw_tv_drm.cpp
+++ b/sdm/libs/core/drm/hw_tv_drm.cpp
@@ -116,8 +116,13 @@
return kErrorResources;
}
- // Reload connector info for updated info after 1st commit
+ // Reload connector info for updated info after 1st commit and validate
drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
+ if (index >= connector_info_.modes.size()) {
+ DLOGE("Invalid mode index %d mode size %d", index, UINT32(connector_info_.modes.size()));
+ return kErrorNotSupported;
+ }
+
DLOGI("Setup CRTC %d, Connector %d for %s", token_.crtc_id, token_.conn_id, device_name_);
current_mode_index_ = index;