Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1441518 > unrolled thread
| Started by | Cathy Avery <cavery@redhat.com> |
|---|---|
| First post | 2016-07-12 17:40 +0200 |
| Last post | 2016-07-25 19:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] PCI: hv: Fix interrupt cleanup path Cathy Avery <cavery@redhat.com> - 2016-07-12 17:40 +0200
RE: [PATCH] PCI: hv: Fix interrupt cleanup path Jake Oshins <jakeo@microsoft.com> - 2016-07-12 18:20 +0200
Re: [PATCH] PCI: hv: Fix interrupt cleanup path Bjorn Helgaas <helgaas@kernel.org> - 2016-07-25 19:40 +0200
| From | Cathy Avery <cavery@redhat.com> |
|---|---|
| Date | 2016-07-12 17:40 +0200 |
| Subject | [PATCH] PCI: hv: Fix interrupt cleanup path |
| Message-ID | <rU7WW-6Ps-37@gated-at.bofh.it> |
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@redhat.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
[toc] | [next] | [standalone]
| From | Jake Oshins <jakeo@microsoft.com> |
|---|---|
| Date | 2016-07-12 18:20 +0200 |
| Message-ID | <rU8zE-7jv-25@gated-at.bofh.it> |
| In reply to | #1441518 |
> -----Original Message-----
> From: Cathy Avery [mailto:cavery@redhat.com]
> Sent: Tuesday, July 12, 2016 8:31 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Jake Oshins <jakeo@microsoft.com>;
> bhelgaas@google.com
> Cc: vkuznets@redhat.com; devel@linuxdriverproject.org; linux-
> pci@vger.kernel.org; linux-kernel@vger.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@redhat.com>
Acked-by: Jake Oshins <jakeo@microsoft.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
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2016-07-25 19:40 +0200 |
| Message-ID | <rYS1c-7ph-13@gated-at.bofh.it> |
| In reply to | #1441518 |
On Tue, Jul 12, 2016 at 11:31:24AM -0400, Cathy Avery wrote:
> 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@redhat.com>
Applied with Jake's ack to pci/host-hv for v4.8, thanks!
For some reason, Jake's ack appears in patchwork and in my personal
email, but I don't see it on the mailing list. Maybe something in
http://vger.kernel.org/majordomo-info.html#taboo is relevant.
> ---
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web