From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 B9B1E43E9D2 for ; Mon, 13 Jul 2026 16:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783961610; cv=none; b=KwM2jN7aUmAkAbLkmLhqKSgqah2UDOY8Q4MiIL+kfzJqNeCwV0AmeMvuq8TBFzxNwsFN1yCRmuyS2cMmNjJPk8TNZLbygZ+ENEQ2FcYqgGW31Zl6mvqBjiPCNcoIWYuMEdg6GIGD3fmwoKGuKNrPL2ztkKKneyXJWY2EFSF2a60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783961610; c=relaxed/simple; bh=W8h/pOX2A68/AN9GGx/hlGAI45Btx/6RAqn1jjPBzJ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WonYFSgQlesnQZjG5q/MXW2Q9WUuLRBxU22RmqWdC4WttVrDCWqyk7xVMX8Sb9h+/4ZVYn0gZ8OlSBxx+WShHgk7hbMSTvkNMwvIHq6gxbTWgrxm4oQ7QpAzzbB6g+jfXsc/qqUe3RycW5hi2hnE7/tVd8cXWlpcUL98DRnK3FM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=WdH04Eem; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="WdH04Eem" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-51c8e2e39easo26577071cf.0 for ; Mon, 13 Jul 2026 09:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783961599; x=1784566399; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1wy5cjU8bpodUKB+73h1Dg8HOClHzWqmvSatqxWWARE=; b=WdH04EemQd7/ddxFpnJx6/Ba7mOZCai2CIoZZdA3LjWi+IXyq70gmGXmYZVaSThPsb o42rA0pJQSel7PbvhX4gdEvmVoPhs+mk342SmDurClN7+uN1ZYh0aTcYIbgN8pN4c03S X17rOMqOEDLDipVofv2jZRTbgaU6bWPKZGZ/fX3oiCR5wTh9Ko6H2YqHKamM7Caj0ydj UeCcy0UzbMcM2dYq4rd7GWTmkWgiRbA1gZWFYxA1lqVO1zw69jCDI1h4+z7mb/Gi2HdO VPkbF903DtIHjEWV/SKdO1hNOxVFz38Vk/u1jbv/3oNSVfs+YFJWkKx5nh3ZX8NznQzx W+Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783961599; x=1784566399; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1wy5cjU8bpodUKB+73h1Dg8HOClHzWqmvSatqxWWARE=; b=T6qRLB1om2EvjCXLgslzJJXNQ8YNJveyhpiP6jg0nm4G3Kl7YfS0FDbbpci7VnITfg hy6BMITPo6j5+n3S2CU7Er02t0EWc67f29oMM+witZIcdnuS4U80CBd2cGSioIq4ghXu LAyRaf6yoYPDluie5mAkgs5dVe7tE9UlZ4zAo7+ERwujvMaa444//mYYFRo/OF9f2WrU V+fcwwhYlnN8KOMLnMNm4NuhIrkdlbE8DWFokCJDVPsLR3JUs2U5egok0XZr95w8daJe ZdYpystwAtLdDcldruWCCri8idA2wh9kncuqMsqUuh8TiOaAz0ETzi2arr1WS3DrwhcK 7ccQ== X-Forwarded-Encrypted: i=1; AHgh+Rp8nVREwCITiTIjkDP7fyZ1NKutLMjyIN1ytO+ioBGYitDfCXvJ7txieUtN6gVJ5VYWEPrqJMzHqvZiL6s=@vger.kernel.org X-Gm-Message-State: AOJu0YxsGlSuWcEv9nftDgDiO6/+ufGVU5gUn1Ic1ksdS5GyoKT3uwfR 8FCJ1meCiJbFXewCEBl9YEJFbp75gJUhyv4ZS4vj7DUP07hgyZgQGwl2smi/3ILGYKg= X-Gm-Gg: AfdE7cksWbPU9X9NfbgYyEieRGtiqD88ngUEZXxVz9iT8aeMYMazgosZ1fNzz6axWDM lo3PP9wIY5NgvS2lMMy6HIZCqpncBwC7e3KhxQ2EHkpp9AI0jD4hG6LvAp2kY7qV29mNvm45m08 ogKt0CGUR0+RaSMLk20eRQY+DStNayMTQKaI6kpKHmNHl4yRSTQaHHY0D1kPoLEbUG/+DNK/tJy N/3QqUV/xCwVKCHvIwW8qjyQzT6sKl4qdHdiKT0u0bUlrCkycbrfbSI+sreA8W3kFIxqGfok6JJ ziYVN2MerWDKhMcDxymRuxXrP3/LzMlPv1XfPWWBgQQTE2KRQU21hYIyrYbEh+98HXj9/IIYK19 oKA6IBVQUEuka2sw6INFxsL1b3ndrOd3JxTW7QE3bUEdZCV2NVo3zIRI63R9h X-Received: by 2002:ac8:6f12:0:b0:51a:8c9a:8fb7 with SMTP id d75a77b69052e-51cbf30ebd1mr99770401cf.72.1783961598776; Mon, 13 Jul 2026 09:53:18 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51caab6e9f4sm88381971cf.2.2026.07.13.09.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 09:53:18 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wjJu9-0000000Dd2s-2yX2; Mon, 13 Jul 2026 13:53:17 -0300 Date: Mon, 13 Jul 2026 13:53:17 -0300 From: Jason Gunthorpe To: Peiyang He Cc: kevin.tian@intel.com, joro@8bytes.org, will@kernel.org, iommu@lists.linux.dev, robin.murphy@arm.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, nicolinc@nvidia.com Subject: Re: [PATCH] iommufd: Fix wrong hwpt passed to iommufd_auto_response_faults on replace Message-ID: <20260713165317.GE3133966@ziepe.ca> References: <9D652384339C69D5+20260710122952.885325-1-peiyang_he@smail.nju.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9D652384339C69D5+20260710122952.885325-1-peiyang_he@smail.nju.edu.cn> On Fri, Jul 10, 2026 at 08:29:52PM +0800, Peiyang He wrote: > iommufd_hwpt_replace_device() calls: > > iommufd_auto_response_faults(hwpt, old_handle); > > passing the *new* hwpt together with the handle of > the device's *old* domain. This should be a parameter mismatch: > > 1. Semantically, iommufd_auto_response_faults(x, handle) scans > x->fault's deliver list and response xarray for groups matching > "handle". A group is queued under the hwpt that was attached at > fault-delivery time. old_handle is fetched *before* the domain switch, > so its group lives on old->fault, not on the new hwpt->fault. > > 2. Historically, the first argument was "old". The routine was > introduced by commit b7d8833677ba ("iommufd: Fault-capable hwpt > attach/detach/replace") as __fault_domain_replace_dev() in > fault.c, correctly calling iommufd_auto_response_faults(old, curr). > Commit fb21b1568ada ("iommufd: Make attach_handle generic than > fault specific") moved this into iommufd_hwpt_replace_device() in > device.c and swapped it to "hwpt". This should be a refactor regression, > not an intentional change. > > Fix this by passing "old" instead. > > Reported-by: Peiyang He > Fixes: fb21b1568ada ("iommufd: Make attach_handle generic than fault specific") > Cc: stable@vger.kernel.org > Signed-off-by: Peiyang He > --- > drivers/iommu/iommufd/device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied Thanks, Jason