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: <CABQX2QNtfJzT_iq0bdsYkz8eUG=r8c8jXyvJ=sp9ipwqfKSErw@mail.gmail.com>
Date: Wed, 3 Jan 2024 22:28:23 -0500
From: Zack Rusin <zack.rusin@...adcom.com>
To: Zhipeng Lu <alexious@....edu.cn>
Cc: Zack Rusin <zackr@...are.com>, 
	VMware Graphics Reviewers <linux-graphics-maintainer@...are.com>, 
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>, 
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
	Matthew Auld <matthew.auld@...el.com>, Christian König <christian.koenig@....com>, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] drm/vmwgfx: fix a memleak in vmw_gmrid_man_get_node

On Mon, Dec 4, 2023 at 4:15 AM Zhipeng Lu <alexious@....edu.cn> wrote:
>
> When ida_alloc_max fails, resources allocated before should be freed,
> including *res allocated by kmalloc and ttm_resource_init.
>
> Fixes: d3bcb4b02fe9 ("drm/vmwgfx: switch the TTM backends to self alloc")
> Signed-off-by: Zhipeng Lu <alexious@....edu.cn>
> ---
>
> Changelog:
>
> v2: Adding {} to correct the if statement
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> index ceb4d3d3b965..a0b47c9b33f5 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
> @@ -64,8 +64,11 @@ static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man,
>         ttm_resource_init(bo, place, *res);
>
>         id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
> -       if (id < 0)
> +       if (id < 0) {
> +               ttm_resource_fini(man, *res);
> +               kfree(*res);
>                 return id;
> +       }
>
>         spin_lock(&gman->lock);

Thanks, I pushed it to drm-misc-next.

z

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ