aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-19 12:38:08 -0500
committerDave Airlie <airlied@redhat.com>2014-11-19 20:35:20 -0500
commitf52b69f1ecfdd7ef6867a257620258c09e569552 (patch)
tree743137d6d11bd5a9ed8bba2484de30c5f630944c /include/drm
parent6f75cea66c8dd043ced282016b21a639af176642 (diff)
drm/atomic: Don't overrun the connector array when hotplugging
Yet another fallout from not considering DP MST hotplug. With the previous patches we have stable indices, but it might still happen that a connector gets added between when we allocate the array and when we actually add a connector. Especially when we back off due to ww mutex contention or similar issues. So store the sizes of the arrays in struct drm_atomic_state and double check them. We don't really care about races except that we want to use a consistent value, so ACCESS_ONCE is all we need. And if we indeed notice that we'd overrun the array then just give up and restart the entire ioctl. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_crtc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 7b28ab032a88..f3142c64e3d5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -825,6 +825,7 @@ struct drm_bridge {
825 * @plane_states: pointer to array of plane states pointers 825 * @plane_states: pointer to array of plane states pointers
826 * @crtcs: pointer to array of CRTC pointers 826 * @crtcs: pointer to array of CRTC pointers
827 * @crtc_states: pointer to array of CRTC states pointers 827 * @crtc_states: pointer to array of CRTC states pointers
828 * @num_connector: size of the @connectors and @connector_states arrays
828 * @connectors: pointer to array of connector pointers 829 * @connectors: pointer to array of connector pointers
829 * @connector_states: pointer to array of connector states pointers 830 * @connector_states: pointer to array of connector states pointers
830 * @acquire_ctx: acquire context for this atomic modeset state update 831 * @acquire_ctx: acquire context for this atomic modeset state update
@@ -836,6 +837,7 @@ struct drm_atomic_state {
836 struct drm_plane_state **plane_states; 837 struct drm_plane_state **plane_states;
837 struct drm_crtc **crtcs; 838 struct drm_crtc **crtcs;
838 struct drm_crtc_state **crtc_states; 839 struct drm_crtc_state **crtc_states;
840 int num_connector;
839 struct drm_connector **connectors; 841 struct drm_connector **connectors;
840 struct drm_connector_state **connector_states; 842 struct drm_connector_state **connector_states;
841 843