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: <20250913090250.0cde9ca3.alex.williamson@redhat.com>
Date: Sat, 13 Sep 2025 09:02:50 +0100
From: Alex Williamson <alex.williamson@...hat.com>
To: Zilin Guan <zilin@....edu.cn>
Cc: brett.creeley@....com, jgg@...pe.ca, yishaih@...dia.com,
 shameerali.kolothum.thodi@...wei.com, kevin.tian@...el.com,
 kvm@...r.kernel.org, linux-kernel@...r.kernel.org, jianhao.xu@....edu.cn
Subject: Re: [PATCH] vfio/pds: replace bitmap_free with vfree

On Fri, 12 Sep 2025 15:04:18 +0000
Zilin Guan <zilin@....edu.cn> wrote:

> host_ack_bmp is allocated with vzalloc but is currently freed via
> bitmap_free (which ends up using kfree).  This is incorrect as
> allocation and deallocation functions should be paired.

This patch is fixing the freeing of host_seq_bmp, not host_ack_bmp.
Both are allocated with vzalloc().  The same logic applies but the
commit log is incorrect.
 
> Using mismatched alloc/free may lead to undefined behavior, memory leaks,
> or system instability.
> 
> This patch fixes the mismatch by freeing host_ack_bmp with vfree to
> match the vzalloc allocation.
> 

Fixes: f232836a9152 ("vfio/pds: Add support for dirty page tracking")

Thanks,
Alex

> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---
>  drivers/vfio/pci/pds/dirty.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/pds/dirty.c b/drivers/vfio/pci/pds/dirty.c
> index c51f5e4c3dd6..481992142f79 100644
> --- a/drivers/vfio/pci/pds/dirty.c
> +++ b/drivers/vfio/pci/pds/dirty.c
> @@ -82,7 +82,7 @@ static int pds_vfio_dirty_alloc_bitmaps(struct pds_vfio_region *region,
>  
>  	host_ack_bmp = vzalloc(bytes);
>  	if (!host_ack_bmp) {
> -		bitmap_free(host_seq_bmp);
> +		vfree(host_seq_bmp);
>  		return -ENOMEM;
>  	}
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ