Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: "Joerg Roedel" <joro@8bytes.org>, "Will Deacon" <will@kernel.org>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"Todd Brandt" <todd.e.brandt@intel.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, "Marcin Mirosław" <marcin@mejor.pl>,
	regressions@leemhuis.info
Subject: Re: [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
Date: Sat, 12 Oct 2024 09:19:44 -0500	[thread overview]
Message-ID: <20241012141944.GA603705@bhelgaas> (raw)
In-Reply-To: <20241012030720.90218-1-baolu.lu@linux.intel.com>

[+cc Marcin, Thorsten]

On Sat, Oct 12, 2024 at 11:07:20AM +0800, Lu Baolu wrote:
> Previously, the domain_context_clear() function incorrectly called
> pci_for_each_dma_alias() to set up context entries for non-PCI devices.
> This could lead to kernel hangs or other unexpected behavior.
> 
> Add a check to only call pci_for_each_dma_alias() for PCI devices. For
> non-PCI devices, domain_context_clear_one() is called directly.
> 
> Reported-by: Todd Brandt <todd.e.brandt@intel.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219363

Likely the same problem reported earlier by Marcin at
https://bugzilla.kernel.org/show_bug.cgi?id=219349

Thanks to Thorsten for pointing this out.

> Fixes: 9a16ab9d6402 ("iommu/vt-d: Make context clearing consistent with context mapping")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>  drivers/iommu/intel/iommu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 9f6b0780f2ef..e860bc9439a2 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -3340,8 +3340,10 @@ static int domain_context_clear_one_cb(struct pci_dev *pdev, u16 alias, void *op
>   */
>  static void domain_context_clear(struct device_domain_info *info)
>  {
> -	if (!dev_is_pci(info->dev))
> +	if (!dev_is_pci(info->dev)) {
>  		domain_context_clear_one(info, info->bus, info->devfn);
> +		return;
> +	}
>  
>  	pci_for_each_dma_alias(to_pci_dev(info->dev),
>  			       &domain_context_clear_one_cb, info);
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-10-12 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12  3:07 [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices Lu Baolu
2024-10-12 14:19 ` Bjorn Helgaas [this message]
2024-10-14  1:39 ` Baolu Lu
2024-10-14 17:10   ` Bjorn Helgaas

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=20241012141944.GA603705@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin@mejor.pl \
    --cc=regressions@leemhuis.info \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=todd.e.brandt@intel.com \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox