Skip to content

Commit fe7c5b3

Browse files
6by9popcornmix
authored andcommitted
drm: Validate connector rotation has one bit set in the rotation property
Copy the same validation logic as from the plane rotation property. Fixes: 8fec3ff ("drm: Add a rotation parameter to connectors.") Signed-off-by: Dave Stevenson <[email protected]>
1 parent 763d1ea commit fe7c5b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpu/drm/drm_atomic_uapi.c

+6
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,12 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
792792
} else if (property == connector->broadcast_rgb_property) {
793793
state->hdmi.broadcast_rgb = val;
794794
} else if (property == connector->rotation_property) {
795+
if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) {
796+
drm_dbg_atomic(connector->dev,
797+
"[CONNECTOR:%d:%s] bad rotation bitmask: 0x%llx\n",
798+
connector->base.id, connector->name, val);
799+
return -EINVAL;
800+
}
795801
state->rotation = val;
796802
} else if (connector->funcs->atomic_set_property) {
797803
return connector->funcs->atomic_set_property(connector,

0 commit comments

Comments
 (0)