Skip to contentSkip to conversation

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

PATCH Applied Jani Nikula 2 participants 6 messages Sep 14, 2023 – Sep 20, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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

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 <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc <[email protected]> # v5.17+

---

UNTESTED

---
 drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -0
index 9913971fa5d2..25ea76558690 100644
@@ -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);
 }
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Jani Nikula

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 <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc <[email protected]> # v5.17+

---

UNTESTED

---
  drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0 -0
index 9913971fa5d2..25ea76558690 100644

drivers/gpu/drm/meson/meson_encoder_hdmi.c static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, · line 341

Quoted 8 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -0
@@ -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 lore raw
Quoted 30 lines · Neil Armstrong
Quoted 29 lines · Jani Nikula

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 <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc <[email protected]> # v5.17+

---

UNTESTED

---
  drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0 -0
index 9913971fa5d2..25ea76558690 100644
@@ -334,6 +334,8 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge,
  			return;
 
Quoted 8 lines

drivers/gpu/drm/meson/meson_encoder_hdmi.c static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, · line 341

Quoted 6 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -0
  		cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid);
+
+		kfree(edid);
  	} else
  		cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier);
  }

Thanks. I don't seem to have a toolchain to get this to build... would you mind applying this, please?

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
#3 lore raw
Quoted 40 lines · Jani Nikula
Quoted 30 lines · Neil Armstrong
Quoted 29 lines · Jani Nikula

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 <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Martin Blumenstingl <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Jerome Brunet <[email protected]>
Cc <[email protected]> # v5.17+

---

UNTESTED

---
   drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 ++
   1 file changed, 2 insertions(+)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0 -0
index 9913971fa5d2..25ea76558690 100644
@@ -334,6 +334,8 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge,
   			return;
 
Quoted 8 lines

drivers/gpu/drm/meson/meson_encoder_hdmi.c static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, · line 341

Quoted 6 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -0
   		cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid);
+
+		kfree(edid);
   	} else
   		cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier);
   }
Quoted 2 lines

Thanks. I don't seem to have a toolchain to get this to build... would you mind applying this, please?

Sure I'll handle this.

Thanks,
Neil

Quoted 5 lines

BR,
Jani.