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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86de1961-8d1c-465a-b822-0dd7cb094d46@amd.com>
Date: Mon, 5 Jan 2026 09:38:54 -0800
From: "Creeley, Brett" <bcreeley@....com>
To: Zilin Guan <zilin@....edu.cn>, jgg@...pe.ca
Cc: yishaih@...dia.com, skolothumtho@...dia.com, kevin.tian@...el.com,
 brett.creeley@....com, alex@...zbot.org, kvm@...r.kernel.org,
 linux-kernel@...r.kernel.org, jianhao.xu@....edu.cn
Subject: Re: [PATCH] vfio/pds: Fix memory leak in pds_vfio_dirty_enable()



On 12/25/2025 6:31 AM, Zilin Guan wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> pds_vfio_dirty_enable() allocates memory for region_info. If
> interval_tree_iter_first() returns NULL, the function returns -EINVAL
> immediately without freeing the allocated memory, causing a memory leak.
>
> Fix this by jumping to the out_free_region_info label to ensure
> region_info is freed.
>
> Fixes: 2e7c6feb4ef52 ("vfio/pds: Add multi-region support")
> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---
>   drivers/vfio/pci/pds/dirty.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vfio/pci/pds/dirty.c b/drivers/vfio/pci/pds/dirty.c
> index 481992142f79..4915a7c1c491 100644
> --- a/drivers/vfio/pci/pds/dirty.c
> +++ b/drivers/vfio/pci/pds/dirty.c
> @@ -292,8 +292,11 @@ static int pds_vfio_dirty_enable(struct pds_vfio_pci_device *pds_vfio,
>          len = num_ranges * sizeof(*region_info);
>
>          node = interval_tree_iter_first(ranges, 0, ULONG_MAX);
> -       if (!node)
> -               return -EINVAL;
> +       if (!node) {
> +               err = -EINVAL;
> +               goto out_free_region_info;
> +       }
> +

Thanks for the fix. I was on vacation, but FWIW:

Reviewed-by: Brett Creeley <brett.creeley@....com>

>          for (int i = 0; i < num_ranges; i++) {
>                  struct pds_lm_dirty_region_info *ri = &region_info[i];
>                  u64 region_size = node->last - node->start + 1;
> --
> 2.34.1
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ