From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 CA6F82E719C for ; Thu, 4 Jun 2026 05:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780550555; cv=none; b=jzqV5AxJjZ7K3LP0Axx6Q314E43ZkOYjMqg2wxreGrSVIl7jBRgjxOwMnEcjcMi9tHH5QMQY5p6/+2dbNZkH5D++g3+k32Yr7Fy3Mizo7BdAIZyVNlw6g+AQgEZb/FBjZoghH0TRVmn0AVzMjRZPCTAgIJP32FBa2NGV9t5jsIU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780550555; c=relaxed/simple; bh=nSVP0hjf/94PXAvWtt46EmkkqHdos3NIt1wmoREGLY8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nR6mVIquWPOpBiAo/UIudXdORghlROd+KDRcwHSDrvMSKusmIwej1bFe404TSEIqEo6bJUIA4ylpRpEPxli7YH9u3JA5iRypG/CJvSyCw8e02CsD4QlNklb7IHXvblDG0a7fLE16V5UE5LR9OGNq7Zt86GAWtMDZqZcFU0WV2rw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JZxGQi/Z; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JZxGQi/Z" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2bf2d865383so47105ad.1 for ; Wed, 03 Jun 2026 22:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780550553; x=1781155353; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Kt92/T/ew+FoBUCV9JwGPlixqsptuzo1rSptMNUtFGY=; b=JZxGQi/ZoJY55Ud+YmV/5Jgyjg3gGH4UpqvamUhzpEfes/iJCykJUhAr65ZPNn7TD0 AmkObVoKH2T+mDO0NetlWdH4A8DnQknOTbmYvvropAh3z1wCIIDRjiG+X8REkDtu2v3R UMhA/uXXMnz5k+YRKMyTcXzdYngqo5btx3OtFDnHaccMjFr9bm0axLrtxGEd94qZmuZM 23kqMhXWzTYa4jbpo3Vzc3DiEcHga+DZ0v4UP8Fkm7W9LoDB43Nrl/e71PEUoXjLuvRp Clv1UN7es8S8533nwVCNniprjeGQz5OJmIH4UcJieYHWwo8mabrHbjPmnjJVNeZivhRb I6sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780550553; x=1781155353; h=in-reply-to:content-disposition: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; bh=Kt92/T/ew+FoBUCV9JwGPlixqsptuzo1rSptMNUtFGY=; b=pVPL6TRlk6VzxEREBLjWyy4TnVJ1KfQYHG5R8EkCNoJngwmtuikyjflW24nBuYna3+ ezyQssZc2wF9LZrolIg28vzw0zdnuJmEWn1zeuE/j4Mjvn7YBNJ7gbqaXLGIp45KdM8o NNWI/k/zDUSMcjg3Y5oiNXJmu9tKmVzlE2uqqT8O5XLthNzXRg/e4ztwSSJNDF0XGJzq hqWsDcqNvYGwz1XExd5bx9AtbbNGc0ASTWTGMlbknFGtcJpb+XHaW3TOjJanX5ep6fHs aSorAOez2HkCUPvFUscJqSQz2nv/WMIq86N5n/G9N1PwMQBHLl1umf8hDXCjrqMqy3UV bggQ== X-Forwarded-Encrypted: i=1; AFNElJ81q2X9rGkW4qkxs+8lnKq85foMhZi7k4Bsj6d5uDxUdQPXG0wZBgAseBZRFSlpySUiRsTrMaVuVPmM19A=@vger.kernel.org X-Gm-Message-State: AOJu0YyVP1Bt/g0LO2m1WNaCwv6H4zT8mMurg52JbM9q0L7YbnZ+xg1W Cvhr3CxdGbPl+3YDNcjR6yges+dBdR3iBO6koHy/WDuPQvmA9sa900rHBAflCGlqVg== X-Gm-Gg: Acq92OF/KTPMlvZv+PFFFMDCnfg6RC5FTbqOKAjTgLVL8ugFh2Fv0bZ0R5+qh8FOFBB FAULgOBLVy7Q9lRpsxZa8Yxa1QaA59pAbOzuZ46aYqIMk3Q64jqI7U9/REyx+kODPRj2X2QNfk2 XC/fVAHWpdzDkdC3WvQVAeqCIullVleZt8wop9mTBzdD+nRMOGbohLnbwgUK9Z7v2n7dHM2moS5 VlUwNSvSA4vgWCWY5+MVKqoxR5OjBA+QX8Nvq40JIH75sn4aO3rW60uhH54lulzNZWr15hsVL4X nK5Rlo/AiZ8HOOS9jyJ2fKyDaNtSlAmEHAxW7w7wNqSBXTPiGRYz8XY2HwEAn7mMor1LAHg6Y9L E1v16rnX+iGR88JW7X4G+ySl/CjuIh75G0mC7UZy/DkNtk8ZQ074lxmpPT155Kf7ZCMBQ2lejWZ hPEttqcncKYct3Jfp8KcOOMY0DyIl49I47ft7bwA/781z4u17TkCTzxtjRdS7uBtK1GT1ger0= X-Received: by 2002:a17:902:f790:b0:2c0:c3ac:fdf9 with SMTP id d9443c01a7336-2c198b295acmr2052415ad.14.1780550552540; Wed, 03 Jun 2026 22:22:32 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c16649d2dfsm43367335ad.75.2026.06.03.22.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 22:22:31 -0700 (PDT) Date: Thu, 4 Jun 2026 05:22:25 +0000 From: Pranjal Shrivastava To: Jason Gunthorpe Cc: "Tian, Kevin" , "iommu@lists.linux.dev" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Joerg Roedel , Will Deacon , Robin Murphy , Baolu Lu , Bjorn Helgaas , Samiullah Khawaja Subject: Re: [PATCH v7 3/5] iommu/arm-smmu-v3: Fix a UAF in the probe_device error path Message-ID: References: <20260601143644.2358771-1-praan@google.com> <20260601143644.2358771-4-praan@google.com> <20260603145903.GC1170766@nvidia.com> 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: <20260603145903.GC1170766@nvidia.com> On Wed, Jun 03, 2026 at 11:59:03AM -0300, Jason Gunthorpe wrote: > On Wed, Jun 03, 2026 at 01:28:29PM +0000, Pranjal Shrivastava wrote: > > On Wed, Jun 03, 2026 at 07:31:38AM +0000, Tian, Kevin wrote: > > > > From: Pranjal Shrivastava > > > > Sent: Monday, June 1, 2026 10:37 PM > > > > > > > > Clear the iommu->priv to NULL while returning an error from probe_device. > > > > > > > > Fixes: a2be6218e649 ("iommu/arm-smmu-v3: Improve add_device() error > > > > handling") > > > > Signed-off-by: Pranjal Shrivastava > > > > > > probably add a note that UAF is theoretical at this point. > > > > > > iommu_init_device() calls dev_iommu_free() right after @probe_device() > > > fails... > > > > Ack. This is just to prevent a UAF against future refactors. I saw the > > intel & amd iommu drivers doing it and felt this is missing from smmuv3 > > That is just pointless dead code, the core code immediately frees the > memory this is NULLing > > static int iommu_init_device(struct device *dev) > { > [..] > err_free: > dev->iommu->iommu_dev = NULL; > dev_iommu_free(dev); > return ret; > > I would remove it from the other drivers not addd it here.. Ack. I tend to agree... I'll drop this patch here and request Baulu to drop it from his PR too. Thanks, Praan