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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Aug 2018 16:15:57 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Li Qiang <liq3ea@...il.com>, alex.williamson@...hat.com,
        eric.auger@...hat.com
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        liqiang02@...p.netease.com
Subject: Re: [PATCH] vfio: fix potential memory leak in vfio_msi_cap_len

On 27.08.2018 14:47, Li Qiang wrote:
> Free the vdev->msi_perm in error path.
> 
> Signed-off-by: Li Qiang <liq3ea@...il.com>
> ---
>  drivers/vfio/pci/vfio_pci_config.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index 115a36f6f403..62023b4a373b 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -1180,8 +1180,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
>  		return -ENOMEM;
>  
>  	ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags);
> -	if (ret)
> +	if (ret) {
> +		kfree(vdev->msi_perm);
>  		return ret;
> +	}
>  
>  	return len;
>  }
> 

Doesn't vfio_config_free() take care of that in all cases?

-- 

Thanks,

David / dhildenb

Powered by blists - more mailing lists