From: Dmitry Baryshkov <dmitry.barysh...@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 <mrip...@kernel.org>
Link: 
https://patchwork.freedesktop.org/patch/msgid/20241206-drm-connector-eld-mutex-v2-5-c9bce1ee8...@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
Signed-off-by: Sasha Levin <sas...@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

Reply via email to