* [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path
@ 2022-12-07 6:59 Miaoqian Lin
2022-12-07 15:01 ` Doug Anderson
2022-12-28 1:58 ` Abhinav Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-12-07 6:59 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Douglas Anderson, Stephen Boyd,
linux-arm-msm, dri-devel, freedreno, linux-kernel
Cc: linmq006
of_icc_get() alloc resources for path1, we should release it when not
need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1.
Defer getting path1 to fix this.
Fixes: b9364eed9232 ("drm/msm/dpu: Move min BW request and full BW disable back to mdss")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- move getting path1 after error check for path0.
---
drivers/gpu/drm/msm/msm_mdss.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index e13c5c12b775..3b8d6991b04e 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -46,15 +46,17 @@ struct msm_mdss {
static int msm_mdss_parse_data_bus_icc_path(struct device *dev,
struct msm_mdss *msm_mdss)
{
- struct icc_path *path0 = of_icc_get(dev, "mdp0-mem");
- struct icc_path *path1 = of_icc_get(dev, "mdp1-mem");
+ struct icc_path *path0;
+ struct icc_path *path1;
+ path0 = of_icc_get(dev, "mdp0-mem");
if (IS_ERR_OR_NULL(path0))
return PTR_ERR_OR_ZERO(path0);
msm_mdss->path[0] = path0;
msm_mdss->num_paths = 1;
+ path1 = of_icc_get(dev, "mdp1-mem");
if (!IS_ERR_OR_NULL(path1)) {
msm_mdss->path[1] = path1;
msm_mdss->num_paths++;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path
2022-12-07 6:59 [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path Miaoqian Lin
@ 2022-12-07 15:01 ` Doug Anderson
2022-12-28 1:58 ` Abhinav Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Doug Anderson @ 2022-12-07 15:01 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Stephen Boyd, linux-arm-msm,
dri-devel, freedreno, linux-kernel
Hi,
On Tue, Dec 6, 2022 at 10:59 PM Miaoqian Lin <linmq006@gmail.com> wrote:
>
> of_icc_get() alloc resources for path1, we should release it when not
> need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1.
> Defer getting path1 to fix this.
>
> Fixes: b9364eed9232 ("drm/msm/dpu: Move min BW request and full BW disable back to mdss")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> changes in v2:
> - move getting path1 after error check for path0.
> ---
> drivers/gpu/drm/msm/msm_mdss.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path
2022-12-07 6:59 [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path Miaoqian Lin
2022-12-07 15:01 ` Doug Anderson
@ 2022-12-28 1:58 ` Abhinav Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Abhinav Kumar @ 2022-12-28 1:58 UTC (permalink / raw)
To: Miaoqian Lin, Rob Clark, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Douglas Anderson, Stephen Boyd,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On 12/6/2022 10:59 PM, Miaoqian Lin wrote:
> of_icc_get() alloc resources for path1, we should release it when not
> need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1.
> Defer getting path1 to fix this.
>
> Fixes: b9364eed9232 ("drm/msm/dpu: Move min BW request and full BW disable back to mdss")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> changes in v2:
> - move getting path1 after error check for path0.
> ---
> drivers/gpu/drm/msm/msm_mdss.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
> index e13c5c12b775..3b8d6991b04e 100644
> --- a/drivers/gpu/drm/msm/msm_mdss.c
> +++ b/drivers/gpu/drm/msm/msm_mdss.c
> @@ -46,15 +46,17 @@ struct msm_mdss {
> static int msm_mdss_parse_data_bus_icc_path(struct device *dev,
> struct msm_mdss *msm_mdss)
> {
> - struct icc_path *path0 = of_icc_get(dev, "mdp0-mem");
> - struct icc_path *path1 = of_icc_get(dev, "mdp1-mem");
> + struct icc_path *path0;
> + struct icc_path *path1;
>
> + path0 = of_icc_get(dev, "mdp0-mem");
> if (IS_ERR_OR_NULL(path0))
> return PTR_ERR_OR_ZERO(path0);
>
> msm_mdss->path[0] = path0;
> msm_mdss->num_paths = 1;
>
> + path1 = of_icc_get(dev, "mdp1-mem");
> if (!IS_ERR_OR_NULL(path1)) {
> msm_mdss->path[1] = path1;
> msm_mdss->num_paths++;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-28 1:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 6:59 [PATCH v2] drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path Miaoqian Lin
2022-12-07 15:01 ` Doug Anderson
2022-12-28 1:58 ` Abhinav Kumar
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).