lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_Mm_LtYXAqGp0O0gk4YF-bM3_cBq6RZ-dBrZkSOQMo3qw@mail.gmail.com>
Date:   Mon, 27 Nov 2023 15:59:39 -0500
From:   Alex Deucher <alexdeucher@...il.com>
To:     Dinghao Liu <dinghao.liu@....edu.cn>
Cc:     Yifan Zhang <yifan1.zhang@....com>,
        Lijo Lazar <lijo.lazar@....com>,
        Yang Wang <kevinyang.wang@....com>,
        dri-devel@...ts.freedesktop.org,
        "Pan, Xinhui" <Xinhui.Pan@....com>, linux-kernel@...r.kernel.org,
        amd-gfx@...ts.freedesktop.org, Le Ma <le.ma@....com>,
        "Stanley.Yang" <Stanley.Yang@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        Darren Powell <darren.powell@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Evan Quan <evan.quan@....com>,
        Christian König <christian.koenig@....com>,
        Hawking Zhang <Hawking.Zhang@....com>
Subject: Re: [PATCH] drm/amd/pm: fix a memleak in aldebaran_tables_init

Applied.  Thanks!

On Thu, Nov 23, 2023 at 3:08 AM Dinghao Liu <dinghao.liu@....edu.cn> wrote:
>
> When kzalloc() for smu_table->ecc_table fails, we should free
> the previously allocated resources to prevent memleak.
>
> Fixes: edd794208555 ("drm/amd/pm: add message smu to get ecc_table v2")
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> index 1a6675d70a4b..f1440869d1ce 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> @@ -257,8 +257,11 @@ static int aldebaran_tables_init(struct smu_context *smu)
>         }
>
>         smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
> -       if (!smu_table->ecc_table)
> +       if (!smu_table->ecc_table) {
> +               kfree(smu_table->metrics_table);
> +               kfree(smu_table->gpu_metrics_table);
>                 return -ENOMEM;
> +       }
>
>         return 0;
>  }
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ