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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Jul 2016 15:54:57 +0000
From:	Jake Oshins <jakeo@...rosoft.com>
To:	Cathy Avery <cavery@...hat.com>, KY Srinivasan <kys@...rosoft.com>,
	Haiyang Zhang <haiyangz@...rosoft.com>,
	"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
	Long Li <longli@...rosoft.com>
CC:	"vkuznets@...hat.com" <vkuznets@...hat.com>,
	"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] PCI: hv: Fix interrupt cleanup path

> -----Original Message-----
> From: Cathy Avery [mailto:cavery@...hat.com]
> Sent: Tuesday, July 12, 2016 8:31 AM
> To: KY Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> <haiyangz@...rosoft.com>; Jake Oshins <jakeo@...rosoft.com>;
> bhelgaas@...gle.com
> Cc: vkuznets@...hat.com; devel@...uxdriverproject.org; linux-
> pci@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH] PCI: hv: Fix interrupt cleanup path
> 
> SR-IOV disabled from the host causes a memory leak.
> pci-hyperv usually first receives a PCI_EJECT notification
> and then proceeds to delete the hpdev list entry in
> hv_eject_device_work(). Later in hv_msi_free() since the
> device is no longer on the device list hpdev is NULL
> and hv_msi_free returns without freeing int_desc as part of
> hv_int_desc_free().
> 
> Signed-off-by: Cathy Avery <cavery@...hat.com>
Acked-by: Jake Oshins <jakeo@...rosoft.com>

> ---
>  drivers/pci/host/pci-hyperv.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index 7e9b2de..449d053 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -732,16 +732,18 @@ static void hv_msi_free(struct irq_domain *domain,
> struct msi_domain_info *info,
> 
>  	pdev = msi_desc_to_pci_dev(msi);
>  	hbus = info->data;
> -	hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn));
> -	if (!hpdev)
> +	int_desc = irq_data_get_irq_chip_data(irq_data);
> +	if (!int_desc)
>  		return;
> 
> -	int_desc = irq_data_get_irq_chip_data(irq_data);
> -	if (int_desc) {
> -		irq_data->chip_data = NULL;
> -		hv_int_desc_free(hpdev, int_desc);
> +	irq_data->chip_data = NULL;
> +	hpdev = get_pcichild_wslot(hbus, devfn_to_wslot(pdev->devfn));
> +	if (!hpdev) {
> +		kfree(int_desc);
> +		return;
>  	}
> 
> +	hv_int_desc_free(hpdev, int_desc);
>  	put_pcichild(hpdev, hv_pcidev_ref_by_slot);
>  }
> 
> --
> 2.5.0

I've tested this.  It's a good fix.  Please take it.

-- Jake Oshins

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ