Setting new_edid to NULL leaks the buffer.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Cc: Markus Schneider-Pargmann msp@baylibre.com Cc: Guillaume Ranquet granquet@baylibre.com Cc: Bo-Chen Chen rex-bc.chen@mediatek.com Cc: CK Hu ck.hu@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
---
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; }
On Thu, 14 Sep 2023 15:10, Jani Nikula jani.nikula@intel.com wrote:
Setting new_edid to NULL leaks the buffer.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Cc: Markus Schneider-Pargmann msp@baylibre.com Cc: Guillaume Ranquet granquet@baylibre.com Cc: Bo-Chen Chen rex-bc.chen@mediatek.com Cc: CK Hu ck.hu@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
Reviewed-by: Guillaume Ranquet granquet@baylibre.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");
new_edid = NULL; }kfree(new_edid);
-- 2.39.2
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(-)
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); }
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
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.
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
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
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/?...
Regards, Chun-Kuang.
Thanks, Jani.
ChenYu
-- Jani Nikula, Intel
Hi, Jani:
Jani Nikula jani.nikula@intel.com 於 2023年9月14日 週四 下午9:13寫道:
Setting new_edid to 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/?...
Regards, Chun-Kuang.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") Cc: Markus Schneider-Pargmann msp@baylibre.com Cc: Guillaume Ranquet granquet@baylibre.com Cc: Bo-Chen Chen rex-bc.chen@mediatek.com Cc: CK Hu ck.hu@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
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
linux-stable-mirror@lists.linaro.org