[PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback error path
Jani Nikula
jani.nikula at intel.com
Thu Sep 14 06:10:58 PDT 2023
Setting new_edid to NULL leaks the buffer.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Cc: Markus Schneider-Pargmann <msp at baylibre.com>
Cc: Guillaume Ranquet <granquet at baylibre.com>
Cc: Bo-Chen Chen <rex-bc.chen at mediatek.com>
Cc: CK Hu <ck.hu at mediatek.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
Cc: Dmitry Osipenko <dmitry.osipenko at collabora.com>
Cc: Chun-Kuang Hu <chunkuang.hu at kernel.org>
Cc: Philipp Zabel <p.zabel at pengutronix.de>
Cc: Matthias Brugger <matthias.bgg at gmail.com>
Cc: dri-devel at lists.freedesktop.org
Cc: linux-mediatek at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: <stable at vger.kernel.org> # v6.1+
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
UNTESTED
---
drivers/gpu/drm/mediatek/mtk_dp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index 2cb47f663756..8fc6eff68e30 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -2049,6 +2049,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,
*/
if (mtk_dp_parse_capabilities(mtk_dp)) {
drm_err(mtk_dp->drm_dev, "Can't parse capabilities\n");
+ kfree(new_edid);
new_edid = NULL;
}
--
2.39.2
More information about the Linux-mediatek
mailing list