* [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
@ 2024-10-12 3:07 Lu Baolu
2024-10-12 14:19 ` Bjorn Helgaas
2024-10-14 1:39 ` Baolu Lu
0 siblings, 2 replies; 5+ messages in thread
From: Lu Baolu @ 2024-10-12 3:07 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian
Cc: Todd Brandt, iommu, linux-kernel, Lu Baolu, stable
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
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
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
2024-10-14 1:39 ` Baolu Lu
1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2024-10-12 14:19 UTC (permalink / raw)
To: Lu Baolu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian, Todd Brandt,
iommu, linux-kernel, stable, Marcin Mirosław, regressions
[+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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
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
@ 2024-10-14 1:39 ` Baolu Lu
2024-10-14 17:10 ` Bjorn Helgaas
1 sibling, 1 reply; 5+ messages in thread
From: Baolu Lu @ 2024-10-14 1:39 UTC (permalink / raw)
To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian
Cc: baolu.lu, Todd Brandt, iommu, linux-kernel, stable
On 2024/10/12 11:07, 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
> 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(-)
Queued for v6.12-rc.
Thanks,
baolu
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
2024-10-14 1:39 ` Baolu Lu
@ 2024-10-14 17:10 ` Bjorn Helgaas
0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2024-10-14 17:10 UTC (permalink / raw)
To: Baolu Lu
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian, Todd Brandt,
iommu, linux-kernel, stable, Marcin Mirosław
[+cc Marcin]
On Mon, Oct 14, 2024 at 09:39:20AM +0800, Baolu Lu wrote:
> On 2024/10/12 11:07, 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
> > 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(-)
>
> Queued for v6.12-rc.
Please include information about Marcin's report as well (assuming it
is the same problem). Marcin did a LOT of work to report and bisect
this, so both should be acknowledged here.
See https://bugzilla.kernel.org/show_bug.cgi?id=219349
Bjorn
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.12-rc
@ 2024-10-14 1:37 Lu Baolu
2024-10-14 1:37 ` [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices Lu Baolu
0 siblings, 1 reply; 5+ messages in thread
From: Lu Baolu @ 2024-10-14 1:37 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel
Hi Joerg,
The following fix has been queued for v6.12-rc:
- Fix incorrect pci_for_each_dma_alias() for non-PCI devices
It fixes boot failure issues on some client platforms. Please consider
it for v6.12-rc.
Best regards,
baolu
Lu Baolu (1):
iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
drivers/iommu/intel/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices
2024-10-14 1:37 [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.12-rc Lu Baolu
@ 2024-10-14 1:37 ` Lu Baolu
0 siblings, 0 replies; 5+ messages in thread
From: Lu Baolu @ 2024-10-14 1:37 UTC (permalink / raw)
To: Joerg Roedel; +Cc: iommu, linux-kernel
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
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219349
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-14 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-10-14 1:39 ` Baolu Lu
2024-10-14 17:10 ` Bjorn Helgaas
-- strict thread matches above, loose matches on Subject: below --
2024-10-14 1:37 [PATCH 0/1] [PULL REQUEST] iommu/vt-d: Fixes for v6.12-rc Lu Baolu
2024-10-14 1:37 ` [PATCH 1/1] iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices Lu Baolu
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.