* [PATCH] drm/gma500: fix double free of gma_connector
@ 2020-10-03 19:39 trix
2020-10-05 13:52 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2020-10-03 19:39 UTC (permalink / raw)
To: patrik.r.jakobsson, airlied, daniel, natechancellor,
ndesaulniers, alan, airlied, yakui.zhao
Cc: clang-built-linux, linux-kernel, dri-devel, Tom Rix
From: Tom Rix <trix@redhat.com>
clang static analysis reports this problem:
cdv_intel_dp.c:2101:2: warning: Attempt to free released memory
kfree(gma_connector);
^~~~~~~~~~~~~~~~~~~~
In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off()
fails, the handler calls cdv_intel_dp_destroy(connector) which does
the first free of gma_connector. So adjust the goto label and skip
the second free.
Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 720a767118c9..deb4fd13591d 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -2083,7 +2083,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
DRM_INFO("failed to retrieve link info, disabling eDP\n");
drm_encoder_cleanup(encoder);
cdv_intel_dp_destroy(connector);
- goto err_priv;
+ goto err_connector;
} else {
DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
intel_dp->dpcd[0], intel_dp->dpcd[1],
--
2.18.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/gma500: fix double free of gma_connector
2020-10-03 19:39 [PATCH] drm/gma500: fix double free of gma_connector trix
@ 2020-10-05 13:52 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2020-10-05 13:52 UTC (permalink / raw)
To: trix
Cc: airlied, ndesaulniers, linux-kernel, yakui.zhao,
clang-built-linux, dri-devel, airlied, natechancellor, alan
On Sat, Oct 03, 2020 at 12:39:28PM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> clang static analysis reports this problem:
>
> cdv_intel_dp.c:2101:2: warning: Attempt to free released memory
> kfree(gma_connector);
> ^~~~~~~~~~~~~~~~~~~~
>
> In cdv_intel_dp_init() when the call to cdv_intel_edp_panel_vdd_off()
> fails, the handler calls cdv_intel_dp_destroy(connector) which does
> the first free of gma_connector. So adjust the goto label and skip
> the second free.
>
> Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")
> Signed-off-by: Tom Rix <trix@redhat.com>
Thanks for your patch, queued in drm-misc-next for 5.11.
-Daniel
> ---
> drivers/gpu/drm/gma500/cdv_intel_dp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> index 720a767118c9..deb4fd13591d 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
> @@ -2083,7 +2083,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
> DRM_INFO("failed to retrieve link info, disabling eDP\n");
> drm_encoder_cleanup(encoder);
> cdv_intel_dp_destroy(connector);
> - goto err_priv;
> + goto err_connector;
> } else {
> DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
> intel_dp->dpcd[0], intel_dp->dpcd[1],
> --
> 2.18.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-05 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03 19:39 [PATCH] drm/gma500: fix double free of gma_connector trix
2020-10-05 13:52 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).