diff mbox series

[1/4] drm/exynos/vidi: fix memory leak in .get_modes()

Message ID 20240530100154.317683-1-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/exynos/vidi: fix memory leak in .get_modes() | expand

Commit Message

Jani Nikula May 30, 2024, 10:01 a.m. UTC
The duplicated EDID is never freed. Fix it.

Cc: stable@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Inki Dae June 10, 2024, 6:32 a.m. UTC | #1
Hi Jani Nikula,

The patch(1/4) has been applied to the -fixes branch, and the other
three patches(2/4 ~ 4/4) have been applied to the -next branch.

Thanks,
Inki Dae

2024년 5월 30일 (목) 오후 7:02, Jani Nikula <jani.nikula@intel.com>님이 작성:
>
> The duplicated EDID is never freed. Fix it.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> index fab135308b70..11a720fef32b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
> @@ -309,6 +309,7 @@ static int vidi_get_modes(struct drm_connector *connector)
>         struct vidi_context *ctx = ctx_from_connector(connector);
>         struct edid *edid;
>         int edid_len;
> +       int count;
>
>         /*
>          * the edid data comes from user side and it would be set
> @@ -328,7 +329,11 @@ static int vidi_get_modes(struct drm_connector *connector)
>
>         drm_connector_update_edid_property(connector, edid);
>
> -       return drm_add_edid_modes(connector, edid);
> +       count = drm_add_edid_modes(connector, edid);
> +
> +       kfree(edid);
> +
> +       return count;
>  }
>
>  static const struct drm_connector_helper_funcs vidi_connector_helper_funcs = {
> --
> 2.39.2
>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index fab135308b70..11a720fef32b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -309,6 +309,7 @@  static int vidi_get_modes(struct drm_connector *connector)
 	struct vidi_context *ctx = ctx_from_connector(connector);
 	struct edid *edid;
 	int edid_len;
+	int count;
 
 	/*
 	 * the edid data comes from user side and it would be set
@@ -328,7 +329,11 @@  static int vidi_get_modes(struct drm_connector *connector)
 
 	drm_connector_update_edid_property(connector, edid);
 
-	return drm_add_edid_modes(connector, edid);
+	count = drm_add_edid_modes(connector, edid);
+
+	kfree(edid);
+
+	return count;
 }
 
 static const struct drm_connector_helper_funcs vidi_connector_helper_funcs = {