[PATCH] drm/meson: fix memory leak on ->hpd_notify callback

Jani Nikula jani.nikula at intel.com
Thu Sep 14 06:10:15 PDT 2023


The EDID returned by drm_bridge_get_edid() needs to be freed.

Fixes: 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")
Cc: Neil Armstrong <narmstrong at baylibre.com>
Cc: Sam Ravnborg <sam at ravnborg.org>
Cc: Martin Blumenstingl <martin.blumenstingl at googlemail.com>
Cc: Neil Armstrong <neil.armstrong at linaro.org>
Cc: Kevin Hilman <khilman at baylibre.com>
Cc: Jerome Brunet <jbrunet at baylibre.com>
Cc: dri-devel at lists.freedesktop.org
Cc: linux-amlogic at lists.infradead.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: <stable at vger.kernel.org> # v5.17+
Signed-off-by: Jani Nikula <jani.nikula at intel.com>

---

UNTESTED
---
 drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
index 9913971fa5d2..25ea76558690 100644
--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
@@ -334,6 +334,8 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge,
 			return;
 
 		cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid);
+
+		kfree(edid);
 	} else
 		cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier);
 }
-- 
2.39.2




More information about the linux-amlogic mailing list