All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkhan@gmail.com>
To: Linda Knippers <lknipper@redhat.com>
Cc: stable <stable@vger.kernel.org>, Joerg Roedel <jroedel@suse.de>
Subject: Re: [RHEL6.8 PATCH 3/3] iommu/vt-d: Fix dmar_domain leak in iommu_attach_device
Date: Thu, 12 Nov 2015 07:47:49 -0700	[thread overview]
Message-ID: <CAKocOOP3sc4cJdp81hbPh3nnxYRhNAbHaR4Yvb8fM2swK2g=4A@mail.gmail.com> (raw)
In-Reply-To: <c0fee2fbc8a8575f5a5867231f305654c35e4cca.1447183903.git.lknipper@redhat.com>

On Tue, Nov 10, 2015 at 1:12 PM, Linda Knippers <lknipper@redhat.com> wrote:
> bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1053879
>
> This is a backport to RHEL6 of Myron's backport to RHEL7.
> http://post-office.corp.redhat.com/archives/rhkernel-list/2015-January/msg00231.html
>
> As Myron notes, the helper functions in the upstream code aren't
> present in RHEL6 or RHEL7 so this code is less readable.  Myron
> didn't backport the helpers because he's planning to rebase the
> code in RHEL7.2.  I didn't backport the helpers to not introduce
> more change.
>
> Myron's comments:
>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1109829
> Upstream Status: 62c22167dd70b730f61c2b88f950e98154a87980
> >From Joerg's iommu/fixes branch intended for v3.19 -
> https://git.kernel.org/cgit/linux/kernel/git/joro/iommu.git/commit/?h=iommu/fixes&id=62c22167dd70b730f61c2b88f950e98154a87980
>
> Conflict:
>   This patch has a dependency on upstream commit ab8dfe2 ("iommu/vt-d:
>   Introduce helper functions to improve code readability") which was
>   introduced during v3.17-rc1.  RHEL7 does not have that commit, and
> thus
>   does not have 'domain_type_is_vm_or_si()'.  As such, this back-port
> uses
>   the older method used prior to the introduction of
>   'domain_type_is_vm_or_si() (see upstream commit ab8dfe2).
>
> commit 62c22167dd70b730f61c2b88f950e98154a87980
> Author: Joerg Roedel <jroedel@suse.de>
> Date:   Tue Dec 9 12:56:45 2014 +0100
>
>     iommu/vt-d: Fix dmar_domain leak in iommu_attach_device
>
>     Since commit 1196c2f a domain is only destroyed in the
>     notifier path if it is hot-unplugged. This caused a
>     domain leakage in iommu_attach_device when a driver was
>     unbound from the device and bound to VFIO. In this case the
>     device is attached to a new domain and unlinked from the old
>     domain. At this point nothing points to the old domain
>     anymore and its memory is leaked.
>     Fix this by explicitly freeing the old domain in
>     iommu_attach_domain.

There is a lot of information in this commit log that isn't appropriate
for a commit log. This information is better fit in the section that goes
in the throw away comments section of the patch. This commit message
is rather confusing and could use some refining.

thanks,
-- Shuah
>
> Fixes: 1196c2f (iommu/vt-d: Fix dmar_domain leak in iommu_attach_device)
> Cc: <stable@vger.kernel.org> # v3.18
> Tested-by: Jerry Hoemann <jerry.hoemann@hp.com>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> Signed-off-by: Linda Knippers <lknipper@redhat.com>
> ---
>  drivers/pci/intel-iommu.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
> index 1c04ed8..80bd6d76 100644
> --- a/drivers/pci/intel-iommu.c
> +++ b/drivers/pci/intel-iommu.c
> @@ -3851,6 +3851,11 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
>                                 domain_remove_one_dev_info(old_domain, pdev);
>                         else
>                                 domain_remove_dev_info(old_domain);
> +
> +                       if (!(old_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
> +                           !(old_domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) &&
> +                           list_empty(&old_domain->devices))
> +                               domain_exit(old_domain);
>                 }
>         }
>
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-11-12 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1447183902.git.lknipper@redhat.com>
2015-11-10 20:12 ` [RHEL6.8 PATCH 3/3] iommu/vt-d: Fix dmar_domain leak in iommu_attach_device Linda Knippers
2015-11-12 14:47   ` Shuah Khan [this message]
2015-11-12 15:00     ` Linda Knippers

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='CAKocOOP3sc4cJdp81hbPh3nnxYRhNAbHaR4Yvb8fM2swK2g=4A@mail.gmail.com' \
    --to=shuahkhan@gmail.com \
    --cc=jroedel@suse.de \
    --cc=lknipper@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.