diff mbox series

[07/10] drm/msm/dp: use eld_mutex to protect access to connector->eld

Message ID 20241201-drm-connector-eld-mutex-v1-7-ba56a6545c03@linaro.org
State New
Headers show
Series drm/connector: add eld_mutex to protect connector->eld | expand

Commit Message

Dmitry Baryshkov Nov. 30, 2024, 11:55 p.m. UTC
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.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/dp/dp_audio.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Abhinav Kumar Dec. 4, 2024, 11:26 p.m. UTC | #1
On 12/3/2024 5:58 AM, Dmitry Baryshkov wrote:
> On Mon, Dec 02, 2024 at 07:27:45PM -0800, Abhinav Kumar wrote:
>>
>>
>> On 11/30/2024 3:55 PM, Dmitry Baryshkov wrote:
>>> 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.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>>    drivers/gpu/drm/msm/dp/dp_audio.c | 2 ++
>>>    1 file changed, 2 insertions(+)
>>>
>>
>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> 
> Ack to merge through drm-misc?
> 

Yes,

Acked-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c
index a599fc5d63c524474276f5db98b05c7c512f332a..61952a0c49861efcb5e7c0884fcb85c040daf9ce 100644
--- a/drivers/gpu/drm/msm/dp/dp_audio.c
+++ b/drivers/gpu/drm/msm/dp/dp_audio.c
@@ -414,8 +414,10 @@  static int dp_audio_get_eld(struct device *dev,
 		return -ENODEV;
 	}
 
+	mutex_lock(&dp_display->connector->eld_mutex);
 	memcpy(buf, dp_display->connector->eld,
 		min(sizeof(dp_display->connector->eld), len));
+	mutex_unlock(&dp_display->connector->eld_mutex);
 
 	return 0;
 }