drm/mediatek/dp: fix memory leak on ->get_edid callback error path
Subsystems (4)
PATCH 1/1 drm/mediatek/dp: fix memory leak on ->get_edid callback error path
Setting new_edid to NULL leaks the buffer.
---
UNTESTED
--- drivers/gpu/drm/mediatek/mtk_dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mediatek/mtk_dp.c +1 -0
@@ -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 ; }
Signature · 1 line
2.39.2
Quoted 19 lines · Jani Nikula
Setting
new_edidto NULL leaks the buffer.Fixes f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")Cc Markus Schneider-Pargmann <[email protected]>Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc CK Hu <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>
Quoted 22 lines
---
UNTESTED
---drivers/gpu/drm/mediatek/mtk_dp.c| 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/mediatek/mtk_dp.c +1
-1@@ -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
PATCH 1/1 drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
In reply to Jani NikulaThe sads returned by drm_edid_to_sad() needs to be freed.
---
Found another one. UNTESTED.
--- drivers/gpu/drm/mediatek/mtk_dp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_dp.c +4 -1
@@ -2034,7 +2034,6 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,bool enabled = mtk_dp->enabled;struct edid *new_edid =NULL ;struct mtk_dp_audio_cfg *audio_caps = &mtk_dp->info.audio_cur_cfg; -struct cea_sad *sads;if (!enabled) {drm_atomic_bridge_chain_pre_enable (bridge, connector->state->state);
@@ -2054,7 +2053,11 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, }if (new_edid) { +struct cea_sad *sads; + audio_caps->sad_count =drm_edid_to_sad (new_edid, &sads); +kfree (sads); + audio_caps->detect_monitor =drm_detect_monitor_audio (new_edid); }
Signature · 1 line
2.39.2
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Quoted 17 lines · Jani Nikula
The sads returned by
drm_edid_to_sad()needs to be freed.Fixes e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>
Looks correct to me.
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Quoted 19 lines · Chen-Yu Tsai
Quoted 17 lines · Jani Nikula
The sads returned by
drm_edid_to_sad()needs to be freed.Fixes e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>
Quoted 3 lines
Looks correct to me.
Reviewed-by Chen-Yu Tsai <[email protected]>
Thanks for the reviews Chen-Yu and Guillaume. Will you push this to drm-misc-next or shall I?
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Quoted 21 lines · Jani Nikula
Quoted 19 lines · Chen-Yu Tsai
Quoted 17 lines · Jani Nikula
The sads returned by
drm_edid_to_sad()needs to be freed.Fixes e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>
Quoted 6 lines
Quoted 3 lines
Looks correct to me.
Reviewed-by Chen-Yu Tsai <[email protected]>Thanks for the reviews Chen-Yu and Guillaume. Will you push this to drm-misc-next or shall I?
Patches for the MediaTek drm driver go through their own separate tree, maintained by CK (Chun-Kuang).
ChenYu
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Quoted 24 lines · Chen-Yu Tsai
Quoted 23 lines · Jani Nikula
Quoted 21 lines · Chen-Yu Tsai
Quoted 17 lines · Jani Nikula
The sads returned by
drm_edid_to_sad()needs to be freed.Fixes e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>Looks correct to me.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Reviewed-by Chen-Yu Tsai <[email protected]>Thanks for the reviews Chen-Yu and Guillaume. Will you push this to drm-misc-next or shall I?
Patches for the MediaTek drm driver go through their own separate tree, maintained by CK (Chun-Kuang).
Chun-Kuang, can you confirm picking up these two patches, please?
MAINTAINERS does not list a separate git repository for MediaTek drm drivers, so I don't know where that would be. It should probably be added to MAINTAINERS.
Thanks,
Jani.
Quoted 2 lines
ChenYu
Signature · 1 line
Jani Nikula, Intel
Re: [PATCH] drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection
Hi, Jani:
Jani Nikula <[email protected]> 於 2023年9月22日 週五 下午5:44寫道:
Quoted 31 lines · Chen-Yu Tsai
Quoted 29 lines · Jani Nikula
Quoted 27 lines · Chen-Yu Tsai
Quoted 19 lines · Jani Nikula
Quoted 17 lines
The sads returned by
drm_edid_to_sad()needs to be freed.Fixes e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>Quoted 3 lines
Looks correct to me.
Reviewed-by Chen-Yu Tsai <[email protected]>Thanks for the reviews Chen-Yu and Guillaume. Will you push this to drm-misc-next or shall I?
Quoted 8 lines
Quoted 2 lines
Patches for the MediaTek drm driver go through their own separate tree, maintained by CK (Chun-Kuang).
Chun-Kuang, can you confirm picking up these two patches, please?
MAINTAINERSdoes not list a separate git repository for MediaTek drm drivers, so I don't know where that would be. It should probably be added toMAINTAINERS.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 9 lines
Thanks,
Jani.Quoted 2 lines
ChenYu
--
Jani Nikula, Intel
Hi, Jani:
Jani Nikula <[email protected]> 於 2023年9月14日 週四 下午9:13寫道:
Quoted 2 lines
Setting
new_edidto NULL leaks the buffer.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 40 lines
Fixes f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")Cc Markus Schneider-Pargmann <[email protected]>Cc Guillaume Ranquet <[email protected]>Cc Bo-Chen Chen <[email protected]>Cc CK Hu <[email protected]>Cc AngeloGioacchino Del Regno <[email protected]>Cc Dmitry Osipenko <[email protected]>Cc Chun-Kuang Hu <[email protected]>Cc Philipp Zabel <[email protected]>Cc Matthias Brugger <[email protected]>Cc <[email protected]> # v6.1+Signed-off-by Jani Nikula <[email protected]>---
UNTESTED
--- drivers/gpu/drm/mediatek/mtk_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/mediatek/mtk_dp.c +1
-1@@ -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