Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1604955 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-03-20 19:20 +0100 |
| Last post | 2017-03-20 19:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] drm/gma500: fix memory leak on edid Colin King <colin.king@canonical.com> - 2017-03-20 19:20 +0100
Re: [PATCH] drm/gma500: fix memory leak on edid walter harms <wharms@bfs.de> - 2017-03-20 19:40 +0100
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-03-20 19:20 +0100 |
| Subject | [PATCH] drm/gma500: fix memory leak on edid |
| Message-ID | <tna4q-52-39@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
edid is allocated on the call to psb_intel_sdvo_get_edid but not
kfree'd at all, causing a memory leak. Fix this by kfree'ing
the edid. (This may be null, but kfree can handle null frees).
Detected by CoverityScan, CID#1090730 ("Resource Leak")
Fixes: 5736995b473b ("gma500: Replace SDVO code with slightly modified version from i915")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/gma500/psb_intel_sdvo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index e787d376ba67..f38e6ad1ab9b 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -1650,6 +1650,7 @@ static bool psb_intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
edid = psb_intel_sdvo_get_edid(connector);
if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
has_audio = drm_detect_monitor_audio(edid);
+ kfree(edid);
return has_audio;
}
--
2.11.0
[toc] | [next] | [standalone]
| From | walter harms <wharms@bfs.de> |
|---|---|
| Date | 2017-03-20 19:40 +0100 |
| Message-ID | <tnanP-iT-105@gated-at.bofh.it> |
| In reply to | #1604955 |
Am 20.03.2017 18:56, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> edid is allocated on the call to psb_intel_sdvo_get_edid but not
> kfree'd at all, causing a memory leak. Fix this by kfree'ing
> the edid. (This may be null, but kfree can handle null frees).
>
> Detected by CoverityScan, CID#1090730 ("Resource Leak")
>
> Fixes: 5736995b473b ("gma500: Replace SDVO code with slightly modified version from i915")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/gma500/psb_intel_sdvo.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> index e787d376ba67..f38e6ad1ab9b 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> @@ -1650,6 +1650,7 @@ static bool psb_intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
> edid = psb_intel_sdvo_get_edid(connector);
> if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
is the check here needed at all ?
drm_detect_monitor_audio--> drm_find_cea_extension -->drm_find_edid_extension (will check for NULL)
I missed DRM_EDID_INPUT_DIGITAL some where ? NTL i would expected drm_detect_monitor_audio to hanle it savely.
re,
wh
> has_audio = drm_detect_monitor_audio(edid);
> + kfree(edid);
>
> return has_audio;
> }
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web