* [PATCH] drm/exynos: hdmi: free EDID on connector update failure
@ 2026-10-12 6:43 Avi Weiss
2026-10-19 13:32 ` Jani Nikula
0 siblings, 1 reply; 4+ messages in thread
From: Avi Weiss @ 2026-10-12 6:43 UTC (permalink / raw)
To: Inki Dae
Cc: Seung-Woo Kim, Kyungmin Park, Jani Nikula, dri-devel,
linux-samsung-soc, linux-kernel, Avi Weiss
If drm_edid_connector_update() fails, hdmi_get_modes() returns
without freeing the EDID allocated by drm_edid_read_ddc(). It's
an unlikely error path but nevertheless possible and should be
cleaned up fully.
Free the EDID before returning, while keeping the existing return
value of 0.
Fixes: f6e4f57fd90dc ("drm/exynos: hdmi: convert to struct drm_edid")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d4fce39c2b61..386557a7f5e8 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -893,8 +893,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
ret = drm_edid_connector_update(connector, drm_edid);
- if (ret)
+ if (ret) {
+ drm_edid_free(drm_edid);
return 0;
+ }
cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/exynos: hdmi: free EDID on connector update failure
2026-10-12 6:43 [PATCH] drm/exynos: hdmi: free EDID on connector update failure Avi Weiss
@ 2026-10-19 13:32 ` Jani Nikula
2026-10-20 5:10 ` Avi Weiss
0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2026-10-19 13:32 UTC (permalink / raw)
To: Avi Weiss, Inki Dae
Cc: Seung-Woo Kim, Kyungmin Park, dri-devel, linux-samsung-soc,
linux-kernel, Avi Weiss
On Mon, 12 Oct 2026, Avi Weiss <thnkslprpt@gmail.com> wrote:
> If drm_edid_connector_update() fails, hdmi_get_modes() returns
> without freeing the EDID allocated by drm_edid_read_ddc(). It's
> an unlikely error path but nevertheless possible and should be
> cleaned up fully.
>
> Free the EDID before returning, while keeping the existing return
> value of 0.
>
> Fixes: f6e4f57fd90dc ("drm/exynos: hdmi: convert to struct drm_edid")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---
> drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index d4fce39c2b61..386557a7f5e8 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -893,8 +893,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
> drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
>
> ret = drm_edid_connector_update(connector, drm_edid);
You could just move the drm_edid_free() call here to avoid duplicating
it.
> - if (ret)
> + if (ret) {
> + drm_edid_free(drm_edid);
> return 0;
> + }
>
> cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
>
>
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/exynos: hdmi: free EDID on connector update failure
2026-10-19 13:32 ` Jani Nikula
@ 2026-10-20 5:10 ` Avi Weiss
2026-10-22 11:11 ` Jani Nikula
0 siblings, 1 reply; 4+ messages in thread
From: Avi Weiss @ 2026-10-20 5:10 UTC (permalink / raw)
To: Jani Nikula
Cc: Inki Dae, Seung-Woo Kim, Kyungmin Park, dri-devel,
linux-samsung-soc, linux-kernel
Hi Jani,
This complicates the if (!drm_edid) a bit further down, so might not
be worth it.
What do you think? Leave it, or should I try to rework it?
Cheers,
Avi
On Mon, 19 Oct 2026 at 16:38, Jani Nikula <jani.nikula@intel.com> wrote:
>
> On Mon, 12 Oct 2026, Avi Weiss <thnkslprpt@gmail.com> wrote:
> > If drm_edid_connector_update() fails, hdmi_get_modes() returns
> > without freeing the EDID allocated by drm_edid_read_ddc(). It's
> > an unlikely error path but nevertheless possible and should be
> > cleaned up fully.
> >
> > Free the EDID before returning, while keeping the existing return
> > value of 0.
> >
> > Fixes: f6e4f57fd90dc ("drm/exynos: hdmi: convert to struct drm_edid")
> > Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> > ---
> > drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > index d4fce39c2b61..386557a7f5e8 100644
> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > @@ -893,8 +893,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
> > drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
> >
> > ret = drm_edid_connector_update(connector, drm_edid);
>
> You could just move the drm_edid_free() call here to avoid duplicating
> it.
>
> > - if (ret)
> > + if (ret) {
> > + drm_edid_free(drm_edid);
> > return 0;
> > + }
> >
> > cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
> >
> >
> > base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
>
> --
> Jani Nikula, Intel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/exynos: hdmi: free EDID on connector update failure
2026-10-20 5:10 ` Avi Weiss
@ 2026-10-22 11:11 ` Jani Nikula
0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2026-10-22 11:11 UTC (permalink / raw)
To: Avi Weiss
Cc: Inki Dae, Seung-Woo Kim, Kyungmin Park, dri-devel,
linux-samsung-soc, linux-kernel
On Tue, 20 Oct 2026, Avi Weiss <thnkslprpt@gmail.com> wrote:
> Hi Jani,
> This complicates the if (!drm_edid) a bit further down, so might not
> be worth it.
> What do you think? Leave it, or should I try to rework it?
Mmmh. Right, very few places actually check for
drm_edid_connector_update() return value, or do anything about it.
> Cheers,
> Avi
>
>
> On Mon, 19 Oct 2026 at 16:38, Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> On Mon, 12 Oct 2026, Avi Weiss <thnkslprpt@gmail.com> wrote:
>> > If drm_edid_connector_update() fails, hdmi_get_modes() returns
>> > without freeing the EDID allocated by drm_edid_read_ddc(). It's
>> > an unlikely error path but nevertheless possible and should be
>> > cleaned up fully.
>> >
>> > Free the EDID before returning, while keeping the existing return
>> > value of 0.
>> >
>> > Fixes: f6e4f57fd90dc ("drm/exynos: hdmi: convert to struct drm_edid")
>> > Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
>> > ---
>> > drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
>> > 1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > index d4fce39c2b61..386557a7f5e8 100644
>> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > @@ -893,8 +893,10 @@ static int hdmi_get_modes(struct drm_connector *connector)
>> > drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
>> >
>> > ret = drm_edid_connector_update(connector, drm_edid);
>>
>> You could just move the drm_edid_free() call here to avoid duplicating
>> it.
>>
>> > - if (ret)
>> > + if (ret) {
>> > + drm_edid_free(drm_edid);
>> > return 0;
>> > + }
>> >
>> > cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
>> >
>> >
>> > base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
>>
>> --
>> Jani Nikula, Intel
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-22 11:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 6:43 [PATCH] drm/exynos: hdmi: free EDID on connector update failure Avi Weiss
2026-10-19 13:32 ` Jani Nikula
2026-10-20 5:10 ` Avi Weiss
2026-10-22 11:11 ` Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®