[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_MPvHgnW-Rpv-caNrgg+9XkVFZs2Oes1gKPyj=TesBKXw@mail.gmail.com>
Date: Mon, 24 Jan 2022 14:19:57 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: Zhou Qingyang <zhou1615@....edu>
Cc: Leo Li <sunpeng.li@....com>, Kangjie Lu <kjlu@....edu>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
LKML <linux-kernel@...r.kernel.org>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
David Airlie <airlied@...ux.ie>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
Alex Deucher <alexander.deucher@....com>,
Lee Jones <lee.jones@...aro.org>,
Christian König <christian.koenig@....com>
Subject: Re: [PATCH] drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth()
Applied. Thanks!
Alex
On Mon, Jan 24, 2022 at 12:05 PM Zhou Qingyang <zhou1615@....edu> wrote:
>
> In calculate_bandwidth(), the tag free_sclk and free_yclk are reversed,
> which could lead to a memory leak of yclk.
>
> Fix this bug by changing the location of free_sclk and free_yclk.
>
> This bug was found by a static analyzer.
>
> Builds with 'make allyesconfig' show no new warnings,
> and our static analyzer no longer warns about this code.
>
> Fixes: 2be8989d0fc2 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap")
> Signed-off-by: Zhou Qingyang <zhou1615@....edu>
> ---
> The analysis employs differential checking to identify inconsistent
> security operations (e.g., checks or kfrees) between two code paths
> and confirms that the inconsistent operations are not recovered in the
> current function or the callers, so they constitute bugs.
>
> Note that, as a bug found by static analysis, it can be a false
> positive or hard to trigger. Multiple researchers have cross-reviewed
> the bug.
>
> drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> index ff5bb152ef49..e6ef36de0825 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> @@ -2033,10 +2033,10 @@ static void calculate_bandwidth(
> kfree(surface_type);
> free_tiling_mode:
> kfree(tiling_mode);
> -free_yclk:
> - kfree(yclk);
> free_sclk:
> kfree(sclk);
> +free_yclk:
> + kfree(yclk);
> }
>
> /*******************************************************************************
> --
> 2.25.1
>
Powered by blists - more mailing lists