From nobody Mon Feb 9 08:19:11 2026 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA57537C0F5 for ; Fri, 30 Jan 2026 19:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769800020; cv=none; b=i2MA67+JL+r9OqaoNl84YWd46h94rXlS5LxC0SyULJRex0B1Mt+DSh/jGbq707q1zdiU9z930FNl3eFUrHaXi0+RipCrqDJ8CiC+YUV7MIn0jmWGY51lTz084zywRrxRKB3siInneiUARJqsJBc7EqoXdnuvwKV657k+OhVMmLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769800020; c=relaxed/simple; bh=hgt8Y1OAKB3dbGheBcK5jgTUMJt3sPVghRJ7H3Fi2hM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DSJis9za/+nOYc3T6O58A4Cp/iuprJeYJO+D1sTTDQ9iuCowkvELq3AQkwfc690aWlN0gWwYlcbhesNlKP3o2FenXAfsPQQO+bnNf2cTO7NITplWYGaEmgdX51PKvlDisZutb2xw/LdDGRqgmalfRJXI34xD4bp+Wf3IwOuXInQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu; spf=pass smtp.mailfrom=u.northwestern.edu; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b=pe2kixf4; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=u.northwestern.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=u-northwestern-edu.20230601.gappssmtp.com header.i=@u-northwestern-edu.20230601.gappssmtp.com header.b="pe2kixf4" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-7cfd9b898cdso1565781a34.2 for ; Fri, 30 Jan 2026 11:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u-northwestern-edu.20230601.gappssmtp.com; s=20230601; t=1769800018; x=1770404818; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Xqyo4QQAQ8EYGfOIWd+mkM8Yl9jqhuESn4SgAxk8u9M=; b=pe2kixf4SWiV4QuzRglqzaMh6zzqkru6uwZBebJMc6QNkq/UzlyLXu9bYGb9gICpYk h+nCZrtfWdA+L8iFze3BXNbFRfcVgn8UiB5bK/9Gjw4JGY8StTtuYponm5q8uzIPRElb Asmd36Vl5wqwEIyWe2eMOgEPBwLBgZ5cxIXc+5Hlx6yy+K5zuWKYZp12EcDCD2e/WiRE Y1SEDebiwV7oHDb0ombZayFQOj5djojauf92GTvw1h3fMX/u60Hz1H2JSq5CgehjsYgw 3iUTak8GjTC7fUp4K/6BG4Yue2ZhxHR/TZ8k6ciZeCuf2M7AFpPaW4HSvTij4FF5D0F4 1clg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769800018; x=1770404818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Xqyo4QQAQ8EYGfOIWd+mkM8Yl9jqhuESn4SgAxk8u9M=; b=j7QwVogYJCyi6uvA2E/oyZKKmlCjZJ1QxoejVwqbcW1KcZPgKtjtE5RrEf3TnrCMSa Y5q7URXk8edBVypw5FJj4KJtOFk7YxBbnWB6piFmZUbpkhNX0edFVYu/BPC60GsF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662:f8a9:9fa with SMTP id 006d021491bc7-6630f3613ecmr1944922eaf.50.1769800017730; Fri, 30 Jan 2026 11:06:57 -0800 (PST) Received: from security.cs.northwestern.edu (security.cs.northwestern.edu. [165.124.184.136]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-662f9a18de2sm5511596eaf.11.2026.01.30.11.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 11:06:57 -0800 (PST) From: Ziyi Guo To: David Woodhouse , Lu Baolu Cc: Joerg Roedel , Will Deacon , Robin Murphy , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Ziyi Guo Subject: [PATCH] iommu/vt-d: fix missing lock in intel_pasid_replace_*() functions Date: Fri, 30 Jan 2026 19:06:55 +0000 Message-Id: <20260130190655.1622261-1-n7l8m4@u.northwestern.edu> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" intel_pasid_replace_first_level(), intel_pasid_replace_second_level(), intel_pasid_replace_pass_through(), and intel_pasid_replace_nested() call their respective pasid_pte_config_*() helpers before acquiring iommu->lock. However, each config function has lockdep_assert_held(&iommu->lock). The corresponding intel_pasid_setup_*() functions correctly acquire iommu->lock before calling the config helpers. Let spin_lock(&iommu->lock) before the pasid_pte_config_*() calls to fix the lockdep assertions and ensure consistent access to IOMMU state. Signed-off-by: Ziyi Guo --- drivers/iommu/intel/pasid.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 3e2255057079..dd4c8287d354 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -431,9 +431,8 @@ int intel_pasid_replace_first_level(struct intel_iommu = *iommu, return -EINVAL; } =20 - pasid_pte_config_first_level(iommu, &new_pte, fsptptr, did, flags); - spin_lock(&iommu->lock); + pasid_pte_config_first_level(iommu, &new_pte, fsptptr, did, flags); pte =3D intel_pasid_get_entry(dev, pasid); if (!pte) { spin_unlock(&iommu->lock); @@ -542,9 +541,8 @@ int intel_pasid_replace_second_level(struct intel_iommu= *iommu, =20 did =3D domain_id_iommu(domain, iommu); =20 - pasid_pte_config_second_level(iommu, &new_pte, domain, did); - spin_lock(&iommu->lock); + pasid_pte_config_second_level(iommu, &new_pte, domain, did); pte =3D intel_pasid_get_entry(dev, pasid); if (!pte) { spin_unlock(&iommu->lock); @@ -686,9 +684,8 @@ int intel_pasid_replace_pass_through(struct intel_iommu= *iommu, struct pasid_entry *pte, new_pte; u16 did =3D FLPT_DEFAULT_DID; =20 - pasid_pte_config_pass_through(iommu, &new_pte, did); - spin_lock(&iommu->lock); + pasid_pte_config_pass_through(iommu, &new_pte, did); pte =3D intel_pasid_get_entry(dev, pasid); if (!pte) { spin_unlock(&iommu->lock); @@ -882,9 +879,8 @@ int intel_pasid_replace_nested(struct intel_iommu *iomm= u, return -EINVAL; } =20 - pasid_pte_config_nestd(iommu, &new_pte, s1_cfg, s2_domain, did); - spin_lock(&iommu->lock); + pasid_pte_config_nestd(iommu, &new_pte, s1_cfg, s2_domain, did); pte =3D intel_pasid_get_entry(dev, pasid); if (!pte) { spin_unlock(&iommu->lock); --=20 2.34.1