openwrt/target/linux/bcm27xx/patches-6.6/950-1461-drm-Validate-connector-rotation-has-one-bit-set-in-t.patch
Álvaro Fernández Rojas 3a5584e0df bcm27xx: pull 6.6 patches from RPi repo
Adds latest 6.6 patches from the Raspberry Pi repository.

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.6.y/
With the following command:
git format-patch -N v6.6.67..HEAD
(HEAD -> 811ff707533bcd67cdcd368bbd46223082009b12)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry picked from commit 692205305db14deeff1a2dc4a6d7f87e19fc418b)
2024-12-28 14:11:52 +01:00

30 lines
1.2 KiB
Diff

From 0b216b3988e5b7035cd5ed8a9910eacbb3420ce0 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
@@ -812,6 +812,12 @@ static int drm_atomic_connector_set_prop
} else if (property == connector->privacy_screen_sw_state_property) {
state->privacy_screen_sw_state = 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,