difos/target/linux/bcm27xx/patches-6.12/950-0699-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch
Álvaro Fernández Rojas 8f9e91ad03 bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-05-21 11:32:18 +02:00

29 lines
1.2 KiB
Diff

From a40bd08d5271472e60e8195479788f7d77569bfc Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 12 Dec 2024 11:59:52 +0000
Subject: [PATCH] drm: Validate connector rotation has one bit set in the
rotation property
Copy the same validation logic as from the plane rotation property.
Fixes: 8fec3ff87049 ("drm: Add a rotation parameter to connectors.")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/drm_atomic_uapi.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -792,6 +792,12 @@ static int drm_atomic_connector_set_prop
} else if (property == connector->broadcast_rgb_property) {
state->hdmi.broadcast_rgb = val;
} else if (property == connector->rotation_property) {
+ if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) {
+ drm_dbg_atomic(connector->dev,
+ "[CONNECTOR:%d:%s] bad rotation bitmask: 0x%llx\n",
+ connector->base.id, connector->name, val);
+ return -EINVAL;
+ }
state->rotation = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,