* [PATCH AUTOSEL 6.6 02/17] printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
@ 2025-01-26 14:55 ` Sasha Levin
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 03/17] drm/connector: add mutex to protect ELD from concurrent access Sasha Levin
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:55 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Kuan-Wei Chiu, Petr Mladek, Sasha Levin
From: Kuan-Wei Chiu <visitorckw@gmail.com>
[ Upstream commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a ]
Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which
leads to undefined behavior. To prevent this, cast 1 to u32 before
performing the shift, ensuring well-defined behavior.
This change explicitly avoids any potential overflow by ensuring that
the shift occurs on an unsigned 32-bit integer.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Acked-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240928113608.1438087-1-visitorckw@gmail.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 0fca282c0a254..dcdf449615bda 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -474,7 +474,7 @@ static struct latched_seq clear_seq = {
/* record buffer */
#define LOG_ALIGN __alignof__(unsigned long)
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
-#define LOG_BUF_LEN_MAX (u32)(1 << 31)
+#define LOG_BUF_LEN_MAX ((u32)1 << 31)
static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
static char *log_buf = __log_buf;
static u32 log_buf_len = __LOG_BUF_LEN;
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 03/17] drm/connector: add mutex to protect ELD from concurrent access
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 02/17] printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX Sasha Levin
@ 2025-01-26 14:55 ` Sasha Levin
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 04/17] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld Sasha Levin
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, maarten.lankhorst,
tzimmermann, airlied, simona, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit df7c8e3dde37a9d81c0613285b43600f3cc70f34 ]
The connector->eld is accessed by the .get_eld() callback. This access
can collide with the drm_edid_to_eld() updating the data at the same
time. Add drm_connector.eld_mutex to protect the data from concurrenct
access. Individual drivers are not updated (to reduce possible issues
while applying the patch), maintainers are to find a best suitable way
to lock that mutex while accessing the ELD data.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-1-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/drm_connector.c | 1 +
drivers/gpu/drm/drm_edid.c | 6 ++++++
include/drm/drm_connector.h | 5 ++++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 309aad5f0c808..35bed66214474 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -277,6 +277,7 @@ static int __drm_connector_init(struct drm_device *dev,
INIT_LIST_HEAD(&connector->probed_modes);
INIT_LIST_HEAD(&connector->modes);
mutex_init(&connector->mutex);
+ mutex_init(&connector->eld_mutex);
mutex_init(&connector->edid_override_mutex);
connector->edid_blob_ptr = NULL;
connector->epoch_counter = 0;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index ee3fab115c4b5..ad872c61aac0e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5499,7 +5499,9 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);
static void clear_eld(struct drm_connector *connector)
{
+ mutex_lock(&connector->eld_mutex);
memset(connector->eld, 0, sizeof(connector->eld));
+ mutex_unlock(&connector->eld_mutex);
connector->latency_present[0] = false;
connector->latency_present[1] = false;
@@ -5530,6 +5532,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,
if (!drm_edid)
return;
+ mutex_lock(&connector->eld_mutex);
+
mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n",
connector->base.id, connector->name,
@@ -5590,6 +5594,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n",
connector->base.id, connector->name,
drm_eld_size(eld), total_sad_count);
+
+ mutex_unlock(&connector->eld_mutex);
}
static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index d300fde6c1a47..b2e9dc02fa349 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1764,8 +1764,11 @@ struct drm_connector {
struct drm_encoder *encoder;
#define MAX_ELD_BYTES 128
- /** @eld: EDID-like data, if present */
+ /** @eld: EDID-like data, if present, protected by @eld_mutex */
uint8_t eld[MAX_ELD_BYTES];
+ /** @eld_mutex: protection for concurrenct access to @eld */
+ struct mutex eld_mutex;
+
/** @latency_present: AV delay info from ELD, if found */
bool latency_present[2];
/**
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 04/17] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 02/17] printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX Sasha Levin
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 03/17] drm/connector: add mutex to protect ELD from concurrent access Sasha Levin
@ 2025-01-26 14:55 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 05/17] drm/bridge: ite-it66121: " Sasha Levin
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, andrzej.hajda,
neil.armstrong, rfoss, maarten.lankhorst, tzimmermann, airlied,
simona, dianders, laurent.pinchart, jani.nikula, nfraprado,
u.kleine-koenig, sui.jingfeng, xji, yuanhsinte, robh, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit e72bf423a60afd744d13e40ab2194044a3af5217 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-2-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 412c6575e87b7..ddf944651c55a 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -2014,8 +2014,10 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,
memset(buf, 0, len);
} else {
dev_dbg(dev, "audio copy eld\n");
+ mutex_lock(&ctx->connector->eld_mutex);
memcpy(buf, ctx->connector->eld,
min(sizeof(ctx->connector->eld), len));
+ mutex_unlock(&ctx->connector->eld_mutex);
}
return 0;
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 05/17] drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (2 preceding siblings ...)
2025-01-26 14:55 ` [PATCH AUTOSEL 6.6 04/17] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 06/17] drm/amd/display: " Sasha Levin
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, ple, neil.armstrong,
andrzej.hajda, rfoss, maarten.lankhorst, tzimmermann, airlied,
simona, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit 39ead6e02ea7d19b421e9d42299d4293fed3064e ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-3-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it66121.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 8f5846b76d594..2381cd1cba879 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1452,8 +1452,10 @@ static int it66121_audio_get_eld(struct device *dev, void *data,
dev_dbg(dev, "No connector present, passing empty EDID data");
memset(buf, 0, len);
} else {
+ mutex_lock(&ctx->connector->eld_mutex);
memcpy(buf, ctx->connector->eld,
min(sizeof(ctx->connector->eld), len));
+ mutex_unlock(&ctx->connector->eld_mutex);
}
mutex_unlock(&ctx->lock);
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 06/17] drm/amd/display: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (3 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 05/17] drm/bridge: ite-it66121: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 07/17] drm/exynos: hdmi: " Sasha Levin
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Harry Wentland, Sasha Levin,
sunpeng.li, Rodrigo.Siqueira, alexander.deucher, christian.koenig,
Xinhui.Pan, airlied, simona, chiahsuan.chung, hamza.mahfooz,
sunil.khatri, alex.hung, aurabindo.pillai, hersenxs.wu, mwen,
Wayne.Lin, amd-gfx, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit 819bee01eea06282d7bda17d46caf29cae4f6d84 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-4-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8a152f4974d3c..aab99df3ba1ae 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -955,8 +955,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
continue;
*enabled = true;
+ mutex_lock(&connector->eld_mutex);
ret = drm_eld_size(connector->eld);
memcpy(buf, connector->eld, min(max_bytes, ret));
+ mutex_unlock(&connector->eld_mutex);
break;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 07/17] drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (4 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 06/17] drm/amd/display: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 08/17] drm/radeon: " Sasha Levin
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, inki.dae,
sw0312.kim, kyungmin.park, airlied, simona, krzk, dri-devel,
linux-arm-kernel, linux-samsung-soc
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit 5e8436d334ed7f6785416447c50b42077c6503e0 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-5-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 906133331a442..c234f9245b144 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1643,7 +1643,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,
struct hdmi_context *hdata = dev_get_drvdata(dev);
struct drm_connector *connector = &hdata->connector;
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 08/17] drm/radeon: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (5 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 07/17] drm/exynos: hdmi: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 09/17] drm/sti: hdmi: " Sasha Levin
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, alexander.deucher,
christian.koenig, Xinhui.Pan, airlied, simona, amd-gfx, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit b54c14f82428c8a602392d4cae1958a71a578132 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-8-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/radeon/radeon_audio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index fc22fe709b9c1..da37a827337bc 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -773,8 +773,10 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port,
if (!dig->pin || dig->pin->id != port)
continue;
*enabled = true;
+ mutex_lock(&connector->eld_mutex);
ret = drm_eld_size(connector->eld);
memcpy(buf, connector->eld, min(max_bytes, ret));
+ mutex_unlock(&connector->eld_mutex);
break;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 09/17] drm/sti: hdmi: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (6 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 08/17] drm/radeon: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 10/17] drm/vc4: " Sasha Levin
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Raphael Gallais-Pou, Sasha Levin,
alain.volmat, maarten.lankhorst, tzimmermann, airlied, simona,
dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit e99c0b517bcd53cf61f998a3c4291333401cb391 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-9-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/sti/sti_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 500936d5743c5..90c68e0f493fb 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1221,7 +1221,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size
struct drm_connector *connector = hdmi->drm_connector;
DRM_DEBUG_DRIVER("\n");
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 10/17] drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (7 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 09/17] drm/sti: hdmi: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 11/17] drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor Sasha Levin
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Dmitry Baryshkov, Maxime Ripard, Sasha Levin, dave.stevenson,
maarten.lankhorst, tzimmermann, airlied, simona, dri-devel
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[ Upstream commit 81a9a93b169a273ccc4a9a1ee56f17e9981d3f98 ]
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-10-c9bce1ee8bea@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 1727d447786f1..541aba80c1449 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2655,9 +2655,9 @@ static int vc4_hdmi_audio_get_eld(struct device *dev, void *data,
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
struct drm_connector *connector = &vc4_hdmi->connector;
- mutex_lock(&vc4_hdmi->mutex);
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
- mutex_unlock(&vc4_hdmi->mutex);
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 11/17] drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (8 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 10/17] drm/vc4: " Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 12/17] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Sasha Levin
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Fangzhi Zuo, Daniel Wheeler, Wayne Lin, Rodrigo Siqueira,
Alex Deucher, Sasha Levin, harry.wentland, sunpeng.li,
Rodrigo.Siqueira, christian.koenig, Xinhui.Pan, airlied, simona,
Wayne.Lin, chiahsuan.chung, agustin.gutierrez, hersenxs.wu,
mario.limonciello, mwen, amd-gfx, dri-devel
From: Fangzhi Zuo <Jerry.Zuo@amd.com>
[ Upstream commit e56ad45e991128bf4db160b75a1d9f647a341d8f ]
Source --> DP2.1 MST hub --> DP1.4/2.1 monitor
When change from DP1.4 to DP2.1 from monitor manual, modes higher than
4k120 are all cutoff by mode validation. Switch back to DP1.4 gets all
the modes up to 4k240 available to be enabled by dsc passthrough.
[why]
Compared to DP1.4 link from hub to monitor, DP2.1 link has larger
full_pbn value that causes overflow in the process of doing conversion
from pbn to kbps.
[how]
Change the data type accordingly to fit into the data limit during
conversion calculation.
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 385a5a75fdf87..5858e288b3fd6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -1578,16 +1578,16 @@ int pre_validate_dsc(struct drm_atomic_state *state,
return ret;
}
-static unsigned int kbps_from_pbn(unsigned int pbn)
+static uint32_t kbps_from_pbn(unsigned int pbn)
{
- unsigned int kbps = pbn;
+ uint64_t kbps = (uint64_t)pbn;
kbps *= (1000000 / PEAK_FACTOR_X1000);
kbps *= 8;
kbps *= 54;
kbps /= 64;
- return kbps;
+ return (uint32_t)kbps;
}
static bool is_dsc_common_config_possible(struct dc_stream_state *stream,
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 12/17] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (9 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 11/17] drm/amd/display: Fix Mode Cutoff in DSC Passthrough to DP2.1 Monitor Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 13/17] drm/bridge: it6505: fix HDCP Bstatus check Sasha Levin
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hermes Wu, Dmitry Baryshkov, AngeloGioacchino Del Regno,
Sasha Levin, andrzej.hajda, neil.armstrong, rfoss,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel
From: Hermes Wu <hermes.wu@ite.com.tw>
[ Upstream commit 85597bc0d70c287ba41f17d14d3d857a38a3d727 ]
A HDCP source device shall support max downstream to 127 devices.
Change definition MAX_HDCP_DOWN_STREAM_COUNT to 127
KSVs shall save for DRM blocked devices check.
This results in struct it6505 growth by ~0.5 KiB.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-4-e0fdd4844703@ite.corp-partner.google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 26d3b9b843267..b7f70c8d14473 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -295,7 +295,7 @@
#define MAX_LANE_COUNT 4
#define MAX_LINK_RATE HBR
#define AUTO_TRAIN_RETRY 3
-#define MAX_HDCP_DOWN_STREAM_COUNT 10
+#define MAX_HDCP_DOWN_STREAM_COUNT 127
#define MAX_CR_LEVEL 0x03
#define MAX_EQ_LEVEL 0x03
#define AUX_WAIT_TIMEOUT_MS 15
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 13/17] drm/bridge: it6505: fix HDCP Bstatus check
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (10 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 12/17] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 14/17] drm/bridge: it6505: fix HDCP encryption when R0 ready Sasha Levin
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hermes Wu, Dmitry Baryshkov, AngeloGioacchino Del Regno,
Sasha Levin, andrzej.hajda, neil.armstrong, rfoss,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel
From: Hermes Wu <hermes.wu@ite.com.tw>
[ Upstream commit 0fd2ff47d8c207fa3173661de04bb9e8201c0ad2 ]
When HDCP is activated,
a DisplayPort source receiving CP_IRQ from the sink
shall check Bstatus from DPCD and process the corresponding value
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-5-e0fdd4844703@ite.corp-partner.google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index b7f70c8d14473..0eb831686a6ea 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2309,14 +2309,20 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
DRM_DEV_DEBUG_DRIVER(dev, "dp_irq_vector = 0x%02x", dp_irq_vector);
if (dp_irq_vector & DP_CP_IRQ) {
- it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
- HDCP_TRIGGER_CPIRQ);
-
bstatus = it6505_dpcd_read(it6505, DP_AUX_HDCP_BSTATUS);
if (bstatus < 0)
return bstatus;
DRM_DEV_DEBUG_DRIVER(dev, "Bstatus = 0x%02x", bstatus);
+
+ /*Check BSTATUS when recive CP_IRQ */
+ if (bstatus & DP_BSTATUS_R0_PRIME_READY &&
+ it6505->hdcp_status == HDCP_AUTH_GOING)
+ it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
+ HDCP_TRIGGER_CPIRQ);
+ else if (bstatus & (DP_BSTATUS_REAUTH_REQ | DP_BSTATUS_LINK_FAILURE) &&
+ it6505->hdcp_status == HDCP_AUTH_DONE)
+ it6505_start_hdcp(it6505);
}
ret = drm_dp_dpcd_read_link_status(&it6505->aux, link_status);
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 14/17] drm/bridge: it6505: fix HDCP encryption when R0 ready
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (11 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 13/17] drm/bridge: it6505: fix HDCP Bstatus check Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 15/17] drm/bridge: it6505: fix HDCP CTS compare V matching Sasha Levin
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hermes Wu, AngeloGioacchino Del Regno, Dmitry Baryshkov,
Sasha Levin, andrzej.hajda, neil.armstrong, rfoss,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel
From: Hermes Wu <hermes.wu@ite.com.tw>
[ Upstream commit 8c01b0bae2f9e58f2fee0e811cb90d8331986554 ]
When starting HDCP authentication, HDCP encryption should be enabled
when R0'is checked.
Change encryption enables time at R0' ready.
The hardware HDCP engine trigger is changed and the repeater KSV fails
will restart HDCP.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-6-e0fdd4844703@ite.corp-partner.google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 0eb831686a6ea..a1ad9a1a59a62 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2078,15 +2078,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);
DRM_DEV_DEBUG_DRIVER(dev, "ksv list ready, ksv list check %s",
ksv_list_check ? "pass" : "fail");
- if (ksv_list_check) {
- it6505_set_bits(it6505, REG_HDCP_TRIGGER,
- HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
+
+ if (ksv_list_check)
return;
- }
+
timeout:
- it6505_set_bits(it6505, REG_HDCP_TRIGGER,
- HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL,
- HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL);
+ it6505_start_hdcp(it6505);
}
static void it6505_hdcp_work(struct work_struct *work)
@@ -2459,7 +2456,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505)
{
struct device *dev = it6505->dev;
- DRM_DEV_DEBUG_DRIVER(dev, "HDCP event Interrupt");
+ DRM_DEV_DEBUG_DRIVER(dev, "HDCP repeater R0 event Interrupt");
+ /* 1B01 HDCP encription should start when R0 is ready*/
+ it6505_set_bits(it6505, REG_HDCP_TRIGGER,
+ HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
+
schedule_work(&it6505->hdcp_wait_ksv_list);
}
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 15/17] drm/bridge: it6505: fix HDCP CTS compare V matching
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (12 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 14/17] drm/bridge: it6505: fix HDCP encryption when R0 ready Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 16/17] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 17/17] safesetid: check size of policy writes Sasha Levin
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hermes Wu, AngeloGioacchino Del Regno, Dmitry Baryshkov,
Sasha Levin, andrzej.hajda, neil.armstrong, rfoss,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel
From: Hermes Wu <hermes.wu@ite.com.tw>
[ Upstream commit 0989c02c7a5c887c70afeae80c64d0291624e1a7 ]
When HDCP negotiation with a repeater device.
Checking SHA V' matching must retry 3 times before restarting HDCP.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-8-e0fdd4844703@ite.corp-partner.google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 32 +++++++++++++++++------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index a1ad9a1a59a62..b23e6f663b18f 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2020,7 +2020,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
{
struct device *dev = it6505->dev;
u8 av[5][4], bv[5][4];
- int i, err;
+ int i, err, retry;
i = it6505_setup_sha1_input(it6505, it6505->sha1_input);
if (i <= 0) {
@@ -2029,22 +2029,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
}
it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av);
+ /*1B-05 V' must retry 3 times */
+ for (retry = 0; retry < 3; retry++) {
+ err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
+ sizeof(bv));
- err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
- sizeof(bv));
+ if (err < 0) {
+ dev_err(dev, "Read V' value Fail %d", retry);
+ continue;
+ }
- if (err < 0) {
- dev_err(dev, "Read V' value Fail");
- return false;
- }
+ for (i = 0; i < 5; i++) {
+ if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
+ av[i][1] != av[i][2] || bv[i][0] != av[i][3])
+ break;
- for (i = 0; i < 5; i++)
- if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
- bv[i][1] != av[i][2] || bv[i][0] != av[i][3])
- return false;
+ DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
+ return true;
+ }
+ }
- DRM_DEV_DEBUG_DRIVER(dev, "V' all match!!");
- return true;
+ DRM_DEV_DEBUG_DRIVER(dev, "V' NOT match!! %d", retry);
+ return false;
}
static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 16/17] drm/bridge: it6505: fix HDCP CTS KSV list wait timer
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (13 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 15/17] drm/bridge: it6505: fix HDCP CTS compare V matching Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 17/17] safesetid: check size of policy writes Sasha Levin
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hermes Wu, AngeloGioacchino Del Regno, Dmitry Baryshkov,
Sasha Levin, andrzej.hajda, neil.armstrong, rfoss,
maarten.lankhorst, mripard, tzimmermann, airlied, simona,
dri-devel
From: Hermes Wu <hermes.wu@ite.com.tw>
[ Upstream commit 9f9eef9ec1a2b57d95a86fe81df758e8253a7766 ]
HDCP must disabled encryption and restart authentication after
waiting KSV for 5s.
The original method uses a counter in a waitting loop that may
wait much longer than it is supposed to.
Use time_after() for KSV wait timeout.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-9-e0fdd4844703@ite.corp-partner.google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index b23e6f663b18f..cedba2a76f014 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2058,12 +2058,13 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
struct it6505 *it6505 = container_of(work, struct it6505,
hdcp_wait_ksv_list);
struct device *dev = it6505->dev;
- unsigned int timeout = 5000;
- u8 bstatus = 0;
+ u8 bstatus;
bool ksv_list_check;
+ /* 1B-04 wait ksv list for 5s */
+ unsigned long timeout = jiffies +
+ msecs_to_jiffies(5000) + 1;
- timeout /= 20;
- while (timeout > 0) {
+ for (;;) {
if (!it6505_get_sink_hpd_status(it6505))
return;
@@ -2072,13 +2073,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
if (bstatus & DP_BSTATUS_READY)
break;
- msleep(20);
- timeout--;
- }
+ if (time_after(jiffies, timeout)) {
+ DRM_DEV_DEBUG_DRIVER(dev, "KSV list wait timeout");
+ goto timeout;
+ }
- if (timeout == 0) {
- DRM_DEV_DEBUG_DRIVER(dev, "timeout and ksv list wait failed");
- goto timeout;
+ msleep(20);
}
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH AUTOSEL 6.6 17/17] safesetid: check size of policy writes
2025-01-26 14:55 [PATCH AUTOSEL 6.6 01/17] drm/virtio: New fence for every plane update Sasha Levin
` (14 preceding siblings ...)
2025-01-26 14:56 ` [PATCH AUTOSEL 6.6 16/17] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Sasha Levin
@ 2025-01-26 14:56 ` Sasha Levin
15 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2025-01-26 14:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Leo Stone, syzbot+4eb7a741b3216020043a, Paul Moore, Sasha Levin,
mortonm, jmorris, serge, linux-security-module
From: Leo Stone <leocstone@gmail.com>
[ Upstream commit f09ff307c7299392f1c88f763299e24bc99811c7 ]
syzbot attempts to write a buffer with a large size to a sysfs entry
with writes handled by handle_policy_update(), triggering a warning
in kmalloc.
Check the size specified for write buffers before allocating.
Reported-by: syzbot+4eb7a741b3216020043a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4eb7a741b3216020043a
Signed-off-by: Leo Stone <leocstone@gmail.com>
[PM: subject tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/safesetid/securityfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/security/safesetid/securityfs.c b/security/safesetid/securityfs.c
index 25310468bcddf..8e1ffd70b18ab 100644
--- a/security/safesetid/securityfs.c
+++ b/security/safesetid/securityfs.c
@@ -143,6 +143,9 @@ static ssize_t handle_policy_update(struct file *file,
char *buf, *p, *end;
int err;
+ if (len >= KMALLOC_MAX_SIZE)
+ return -EINVAL;
+
pol = kmalloc(sizeof(struct setid_ruleset), GFP_KERNEL);
if (!pol)
return -ENOMEM;
--
2.39.5
^ permalink raw reply related [flat|nested] 17+ messages in thread