--- /dev/null
+From bbaa@bbaa.fun Wed Jul 23 14:10:01 2025
+From: Ban ZuoXiang <bbaa@bbaa.fun>
+Date: Wed, 23 Jul 2025 20:04:23 +0800
+Subject: iommu/vt-d: Fix misplaced domain_attached assignment
+To: stable@vger.kernel.org
+Cc: iommu@lists.linux.dev, baolu.lu@linux.intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Ban ZuoXiang <bbaa@bbaa.fun>
+Message-ID: <468CF4B655888074+20250723120423.37924-1-bbaa@bbaa.fun>
+
+From: Ban ZuoXiang <bbaa@bbaa.fun>
+
+Commit fb5873b779dd ("iommu/vt-d: Restore context entry setup order
+for aliased devices") was incorrectly backported: the domain_attached
+assignment was mistakenly placed in device_set_dirty_tracking()
+instead of original identity_domain_attach_dev().
+
+Fix this by moving the assignment to the correct function as in the
+original commit.
+
+Fixes: fb5873b779dd ("iommu/vt-d: Restore context entry setup order for aliased devices")
+Closes: https://lore.kernel.org/linux-iommu/721D44AF820A4FEB+722679cb-2226-4287-8835-9251ad69a1ac@bbaa.fun/
+Cc: stable@vger.kernel.org
+Reported-by: Ban ZuoXiang <bbaa@bbaa.fun>
+Signed-off-by: Ban ZuoXiang <bbaa@bbaa.fun>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iommu/intel/iommu.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/iommu/intel/iommu.c
++++ b/drivers/iommu/intel/iommu.c
+@@ -4414,9 +4414,6 @@ static int device_set_dirty_tracking(str
+ break;
+ }
+
+- if (!ret)
+- info->domain_attached = true;
+-
+ return ret;
+ }
+
+@@ -4600,6 +4597,9 @@ static int identity_domain_attach_dev(st
+ ret = device_setup_pass_through(dev);
+ }
+
++ if (!ret)
++ info->domain_attached = true;
++
+ return ret;
+ }
+