DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Kevin Laatz <kevin.laatz@intel.com>
Cc: dev@dpdk.org, "Bruce Richardson" <bruce.richardson@intel.com>,
	"Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: [PATCH] bus: fix memleak during pci device cleanup
Date: Wed, 19 Oct 2022 13:40:03 +0200	[thread overview]
Message-ID: <CAJFAV8wEnd=tyjnJccedUC9QnR3kxju9QaFxfLaFHPxx+_oqaQ@mail.gmail.com> (raw)
In-Reply-To: <20221019104923.1240394-1-kevin.laatz@intel.com>

On Wed, Oct 19, 2022 at 12:46 PM Kevin Laatz <kevin.laatz@intel.com> wrote:
>
> During PCI bus device cleanup some interrupt handle pointers and the
> bus_info pointer are not being free'd, leading to memory leaks.
> This patch fixes the memory leaks by ensuring they are free'd during
> device cleanup on exit.
>
> Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
>
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
>  drivers/bus/pci/pci_common.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 7f598667fe..330a41ed12 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -456,6 +456,20 @@ pci_cleanup(void)
>                 }
>                 dev->driver = NULL;
>                 dev->device.driver = NULL;
> +
> +               /* free interrupt handles */
> +               if (dev->intr_handle != NULL) {

rte_intr_instance_free already handles NULL, no need for the check.

> +                       rte_intr_instance_free(dev->intr_handle);
> +                       dev->intr_handle = NULL;
> +                       rte_intr_instance_free(dev->vfio_req_intr_handle);
> +                       dev->vfio_req_intr_handle = NULL;
> +               }
> +
> +               if (dev->bus_info != NULL) {

Idem.


> +                       free(dev->bus_info);
> +                       dev->bus_info = NULL;
> +               }
> +
>                 free(dev);
>         }
>
> --
> 2.31.1
>


-- 
David Marchand


  reply	other threads:[~2022-10-19 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 10:49 Kevin Laatz
2022-10-19 11:40 ` David Marchand [this message]
2022-10-19 12:37 ` [PATCH v2] " Kevin Laatz
2022-10-20  5:31   ` Li, WeiyuanX
2022-10-20  9:19   ` David Marchand
2022-10-20 11:31     ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8wEnd=tyjnJccedUC9QnR3kxju9QaFxfLaFHPxx+_oqaQ@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=kevin.laatz@intel.com \
    --cc=mb@smartsharesystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).