From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 E0AC13A874F for ; Fri, 29 May 2026 07:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780038297; cv=none; b=JVmGWhwpz/hRQ125IFsxL50o3BRmEj5263RtWsPhO+lnqlYgnRFWYw1ekvElMJCOLdgt2903RxTGEq7KrjQnvC8fe+eo+MhAMij8o24xh26p3xq+6CYxG0VOwYWxxBI3lDqs2YYfD7YUtRbXT1Skffb+eqqwZOZcoEF5gXuUVzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780038297; c=relaxed/simple; bh=iam0u/2Jl6XkPvwi1qwhiflT+1xKVHGWQhuOjLQOVSs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ick9XZh2qduSyCkHuEiiYh3IKFvJMCYLqrLsRzsNVT/vj2XHMGihgKsyXgdmaw37cU6OaGIIjgfzU3VhL7ykuiIYMYwo1NN07OTGPdEJ5+SoYhrQwKCyhLptkbvZnnoFeWUT2pdl3yqqEjaFr9XP0++OwSTiSFddGDNtA7rH+HU= 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=O7vyKSW3; arc=none smtp.client-ip=209.85.214.174 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="O7vyKSW3" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2bf2911f93cso865ad.1 for ; Fri, 29 May 2026 00:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780038295; x=1780643095; 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=xpdj4zdvOr4RmzrDJJcOOQOaZ4aQerKSX3Hu7HK0Ghk=; b=O7vyKSW39lsdQU5/LCB++owNRtEWOQSXfBdE1Q3ZAy+qWL08SHYBYn0Azgng5ELroj vZdXHMy13eMtbLFQmHSw1rcYqpvgBvla/G6oRaI96MhfMUNcr/bM+UuC8zALsyFRkKJq MXHgJCchgGf0eFzlghEMGYg/m95bnz9t3ZTDEL9eEEfpqJxZ/O9vq2rpOfB5gsgza1K0 xq/xgm4e6U/wpRZa2KgT5VAUjUJinRBC/s9RXSGoliFwiScLYp/M8NOo/7jKtJuy9vVY rpYLts15OS8LJJdMWS1cmJN4KXN5bX3bJ1Ci9Ye4EQ/82wUF14ZmJfU+AkHCncMvAPlU H5ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780038295; x=1780643095; 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=xpdj4zdvOr4RmzrDJJcOOQOaZ4aQerKSX3Hu7HK0Ghk=; b=VgOzV7mtPFzl/34c5AqSLO9GGux2N2IvzwkV8E6JuukRbQlCUb1EUbANMmhAqJkvGM eN2EjuQhVtErDIulDLKPy85Zd1knDtODVxg18oy37juJlOtQmM1KPJFjYcXegKvoES7e Cp+zR/c4W2Cii4aL5hRVakt1biVkFQkVTDPSAV8MtKDjTzrP4CxG/V97muNnRBYnVZAH 5a/rqjQDPJN1m7dE4BlYNc57icO7Wx91yi2P4j7uAjwcl5gZ45+dR+QyefnkEZTSEu7u I0vGL41TDYSK8Yk6mIp8I8drxsbkjIWqDMCZcKMaR66HTpdibctJAKPvupd64X9VjAAu +ciw== X-Forwarded-Encrypted: i=1; AFNElJ/gr0cXMToJzAF1QrpZJGRtT/UXq1RF2FFoyh5fFpHqanBlab+43ZsWeeJKMENRPTFS1+jjaN/G3lCXTJY=@vger.kernel.org X-Gm-Message-State: AOJu0YxH23kzDhDyMPaIva+e7aBjRpAbkYWOFTAO5qoDZm9s7jDm2J1W w8LnTyNBIyMn4HBNRxvnRyIYjQb84wnxrdma9fuzv2VxAcZXPzwjXm+yf4dUzD+6Cg== X-Gm-Gg: Acq92OF5nStnLYNb5391KBQod5KOueqxOuxutJdPnl8A+ECOiiWj+RhoKOPq7WYr3oB XiVw24Vv2Xixgl+RhA/db8+n2sKE5JQr3f63i+nCwG1VJs9f4W1HC8nRX/DyGaLTf058M7sx8vx rYOuHIP4HaUecYG9csb66YFhRzBIvk6XYXMomklkXsq1ZPX+3U65oGGiwuNjVB+5L42bWihmyEi qNjlx6ZpJbZ800QVlHMXCjpovXB6oHcwpV3OEIls7c1E/+pfB1S4A7IhHATX8kZZu74O2LOb2Ss 4P+tLdozZoKAMbXu+zjriccbyg1kyuCD6TXL28AxSR2c4d0bhqZ7ZE+kJbdJ6ZJ5wtbhPaxwcJE VaFO7snlSZRS+eGR9UCVpjTafclhKdo6VbxO0s7gaCcsTzhT9hmfyACyUAezPwr2755B+gURhF5 sgv/wkpAoiokwyaO8Ya9puUyDlotcE605yvxMM8s+XiuuEuFnTy4WPrr6qU9Q5TlPnN9hS X-Received: by 2002:a17:902:db0f:b0:2ba:73c3:49b0 with SMTP id d9443c01a7336-2bf20d1645bmr1335815ad.14.1780038294503; Fri, 29 May 2026 00:04:54 -0700 (PDT) Received: from google.com (44.234.124.34.bc.googleusercontent.com. [34.124.234.44]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85771a7c24sm914873a12.2.2026.05.29.00.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 00:04:53 -0700 (PDT) Date: Fri, 29 May 2026 07:04:46 +0000 From: Pranjal Shrivastava To: Baolu Lu Cc: iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joerg Roedel , Will Deacon , Bjorn Helgaas , David Woodhouse , Robin Murphy , Suravee Suthikulpanit , Jason Gunthorpe , Nicolin Chen , David Matlack , Samiullah Khawaja , Daniel Mentz , Pasha Tatashin , Mostafa Saleh , sashiko-bot@kernel.org Subject: Re: [PATCH v5 5/7] iommu/vt-d: Fix RB-tree corruption and Use-After-Free in probe Message-ID: References: <20260528202353.3422206-1-praan@google.com> <20260528202353.3422206-6-praan@google.com> <5c5e85f1-f745-4667-af0d-30af71288294@linux.intel.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: <5c5e85f1-f745-4667-af0d-30af71288294@linux.intel.com> On Fri, May 29, 2026 at 11:20:47AM +0800, Baolu Lu wrote: > On 5/29/26 04:23, Pranjal Shrivastava wrote: > > The intel_iommu_probe_device() function contains two pre-existing > > memory safety issues on its error path: > > > > 1. The info->node RB-tree member is zero-initialized via kzalloc. If > > a device does not support ATS, the device_rbtree_insert() call is > > skipped. If a subsequent probe step fails, the error path jumps to > > device_rbtree_remove(), which misinterprets the zeroed node as > > a tree root and corrupts the device RB-tree. > > > > 2. The info structure is freed on failure, but the pointer remains > > linked to the device via dev_iommu_priv_set(). This leads to a > > Use-After-Free regression if the pointer is accessed later. > > > > Fix these by explicitly initializing the RB-node as empty and guarding > > its removal. Additionally, ensure dev_iommu_priv_set(dev, NULL) is > > called before freeing the info structure in the error path. > > Thanks for the fixes. Could you please separate these two fixes into two > distinct patches and post them as a standalone series? These two fixes > are quick cleanups and are not part of the current series, which focuses > on improving the robustness of ATS enablement. Ack. I'll send these as stanalone patches. I added these here to keep Sashiko at bay. Thanks, Praan