diff mbox series

drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection

Message ID 20230914155317.2511876-1-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection | expand

Commit Message

Jani Nikula Sept. 14, 2023, 3:53 p.m. UTC
The sads returned by drm_edid_to_sad() needs to be freed.

Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
Cc: Guillaume Ranquet <granquet@baylibre.com>
Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: <stable@vger.kernel.org> # v6.1+
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Found another one. UNTESTED.
---
 drivers/gpu/drm/mediatek/mtk_dp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Chen-Yu Tsai Sept. 15, 2023, 5:28 a.m. UTC | #1
On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula <jani.nikula@intel.com> wrote:
>
> The sads returned by drm_edid_to_sad() needs to be freed.
>
> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
> Cc: Guillaume Ranquet <granquet@baylibre.com>
> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-mediatek@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: <stable@vger.kernel.org> # v6.1+
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Looks correct to me.

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Jani Nikula Sept. 19, 2023, 11:02 a.m. UTC | #2
On Fri, 15 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
> On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> The sads returned by drm_edid_to_sad() needs to be freed.
>>
>> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
>> Cc: Guillaume Ranquet <granquet@baylibre.com>
>> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
>> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> Cc: Matthias Brugger <matthias.bgg@gmail.com>
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: linux-mediatek@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: <stable@vger.kernel.org> # v6.1+
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Looks correct to me.
>
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

Thanks for the reviews Chen-Yu and Guillaume. Will you push this to
drm-misc-next or shall I?

BR,
Jani.
Chen-Yu Tsai Sept. 19, 2023, 11:04 a.m. UTC | #3
On Tue, Sep 19, 2023 at 7:02 PM Jani Nikula <jani.nikula@intel.com> wrote:
>
> On Fri, 15 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
> > On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula <jani.nikula@intel.com> wrote:
> >>
> >> The sads returned by drm_edid_to_sad() needs to be freed.
> >>
> >> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
> >> Cc: Guillaume Ranquet <granquet@baylibre.com>
> >> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> >> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> >> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> >> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> >> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> >> Cc: dri-devel@lists.freedesktop.org
> >> Cc: linux-mediatek@lists.infradead.org
> >> Cc: linux-kernel@vger.kernel.org
> >> Cc: linux-arm-kernel@lists.infradead.org
> >> Cc: <stable@vger.kernel.org> # v6.1+
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >
> > Looks correct to me.
> >
> > Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
>
> 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
Jani Nikula Sept. 22, 2023, 9:44 a.m. UTC | #4
On Tue, 19 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
> On Tue, Sep 19, 2023 at 7:02 PM Jani Nikula <jani.nikula@intel.com> wrote:
>>
>> On Fri, 15 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
>> > On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula <jani.nikula@intel.com> wrote:
>> >>
>> >> The sads returned by drm_edid_to_sad() needs to be freed.
>> >>
>> >> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
>> >> Cc: Guillaume Ranquet <granquet@baylibre.com>
>> >> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
>> >> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> >> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>> >> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>> >> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> >> Cc: Matthias Brugger <matthias.bgg@gmail.com>
>> >> Cc: dri-devel@lists.freedesktop.org
>> >> Cc: linux-mediatek@lists.infradead.org
>> >> Cc: linux-kernel@vger.kernel.org
>> >> Cc: linux-arm-kernel@lists.infradead.org
>> >> Cc: <stable@vger.kernel.org> # v6.1+
>> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> >
>> > Looks correct to me.
>> >
>> > Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
>>
>> 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.

>
> ChenYu
Chun-Kuang Hu Sept. 24, 2023, 2:27 p.m. UTC | #5
Hi, Jani:

Jani Nikula <jani.nikula@intel.com> 於 2023年9月22日 週五 下午5:44寫道:
>
> On Tue, 19 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
> > On Tue, Sep 19, 2023 at 7:02 PM Jani Nikula <jani.nikula@intel.com> wrote:
> >>
> >> On Fri, 15 Sep 2023, Chen-Yu Tsai <wenst@chromium.org> wrote:
> >> > On Thu, Sep 14, 2023 at 11:53 PM Jani Nikula <jani.nikula@intel.com> wrote:
> >> >>
> >> >> The sads returned by drm_edid_to_sad() needs to be freed.
> >> >>
> >> >> Fixes: e71a8ebbe086 ("drm/mediatek: dp: Audio support for MT8195")
> >> >> Cc: Guillaume Ranquet <granquet@baylibre.com>
> >> >> Cc: Bo-Chen Chen <rex-bc.chen@mediatek.com>
> >> >> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >> >> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> >> >> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> >> >> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> >> >> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> >> >> Cc: dri-devel@lists.freedesktop.org
> >> >> Cc: linux-mediatek@lists.infradead.org
> >> >> Cc: linux-kernel@vger.kernel.org
> >> >> Cc: linux-arm-kernel@lists.infradead.org
> >> >> Cc: <stable@vger.kernel.org> # v6.1+
> >> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> >
> >> > Looks correct to me.
> >> >
> >> > Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
> >>
> >> 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.

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.

>
> Thanks,
> Jani.
>
> >
> > ChenYu
>
> --
> Jani Nikula, Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index 8fc6eff68e30..0e285df6577e 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -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);
 	}