Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=192.198.163.14 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796155788; b=Q7VRxKw8ILswIleENiOk1P6YNTPzeb5rQg5RG/nnaChwFP4z1bqX+Z1RNgnYLkFL2O38 fwLU/94iZYXNAmmYkgCC4fLGcb+A2pZ73X4rE9wNCaFToK7Z+lhv9tKayaGz1iPkHlKTC jZoF83BHVZq4dmHrtOy3B7CjcBfKDuQGwHlubSFXUMLlg6xdLmQAhcdOYbU5cUfJgyb0i 1/j/Sva0OjYpaW1JHqyyVyToM7QRc5Cl6QE6MI3r2+rLGh7CE5x0p9i5eWLcwKAf41AF0 1+TwRYwTsijOUhyzDUJFCRhuX1k8f2vamCF8c0ZqYdANU89zu6C4e7DMd16YXbUcIDQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796155788; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=vr8MHHRBArGCHQqyO+ZKkEWdLyFKX/kIJf/veHGx9Tk=; b=byMSwye4vEaEAQ4Mx5UItlBHWfFtq95bfIPJTv2lbb5W1zGgZYrAVOJSueZJg8uqRb6E oPlUCzBcJ2x26qABp3IJMQnJGiM1naaYLMCjUfuT3Y9/QvTjcR7LU93jxM5erXzD6zN8R dgO7HRlPxwM3PEC/piLw/hqnc5qGqAMiusMKV9XdCgRaG2gpZ6wKq2j4S2zv0GRpVDReK r8L1nyUZ1Ae7c/3hijUznmXHNTkHYtJvt9QngVQ3NFFpfVmmTqOsUartCZz3Soa50T0i4 PUr8QdO7QEsTbEnV26VeqXyoliBGS7dYjZ3GapZ0bSmrtqnbMNdiYZPaxftGzlfDGgA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FGvS7H1r; arc=pass header.oldest-pass=0 smtp.remote-ip=192.198.163.14 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8368D606A322 for ; Tue, 1 Dec 2026 20:09:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8368D606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FGvS7H1r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796155787; x=1827691787; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=vr8MHHRBArGCHQqyO+ZKkEWdLyFKX/kIJf/veHGx9Tk=; b=FGvS7H1r8hdvuOwFjGbh44V7aBroMfD9GbYWFCZKWceVJnK8mRlQWLnV 12l6I5Ps77jC1Cc2A4V4mI3ca0j32X5aSdylScwTdXqSEJ9YpC4/hgOGv U/nm7pZEUcqmzmDnh2meqavyR3w43I7OQbc1NRljH7Ili4ODTDB2uwoYc 8xEOLmmqb0phWhDqX0N6gvzf5PhIFPbxuzXzj4gspVJVhR7xO3XmYY10I 5T4459TJq1PV1e2836+naenToUDcxdtmC9bU0RHCW93UifZTDCnoM2nIy bx8FlILTFBKh0Cy5pv+4IA4BF0DWqCFbWm4JKPiQq1TxhoPiU4IC6A5Uz Q==; X-CSE-ConnectionGUID: JWU1VmpISr2sgr1ZcGlX+A== X-CSE-MsgGUID: gF1zdDLqSgi8dOUPnAGTZA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5016268" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5016268" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 12:09:46 -0800 X-CSE-ConnectionGUID: IzRv+MobTaai6ZPPMi4+DA== X-CSE-MsgGUID: sWiMXH4gScqT5QAqmMMsSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13198523" Received: from fmsmsx902.amr.corp.intel.com ([10.18.126.91]) by orviesa003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 12:09:47 -0800 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) by fmsmsx902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 12:09:46 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) by FMSMSX903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 12:09:46 -0800 Received: from CH1PR05CU001.outbound.protection.outlook.com (52.101.193.37) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 12:09:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P2OrKnPHeMYWWjlIw7r4JYvmtFO2qt8IMqNs+gzSj0lKf/aW/GXQ9cH9PVhTSaEa+rgl/wcyULmCvjMQG26+CVs6y/HbuBsJWFHDU6EL2WdGd7u+Eia/5N+KNyaCXNRN7Fo3w6e3w9YYaXjWjhIwkuq8AfVwYtWolnFV0UlrqpaoPGoowFHskrKM7iD38pxKwxCDDjkECPhViwYr6XrCEN2c6U3/2MjmvjuupMSdrmPUBGNcYno4PSUa1izb9aAqmdt6M8NBJtlMLrE/89Ca3wBXysL8vOAEQgQNFyIt0/wjtRxyR0OPxprdizK/dekv17qW9bJ8+vWDMwZcGGIaDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vr8MHHRBArGCHQqyO+ZKkEWdLyFKX/kIJf/veHGx9Tk=; b=hBTOw8dNHZN+nSuzv4tX+4R6477GbYS34L290Y2z7uAoyQpkvTohs0HjNDF+78XsLHwoE2dMA5yg2j3mjW104hhoY9F24wqidxqR18PZ9nimWHcPqyC6zSsfVRVE+Gnncl4LJkZS6+U6NLFaZZtZ+sqHMcRZ2Q7CgEpIcgHzraD7yv9y9xX8+BbKF1rbOzHiBwKDt0lPtk6xUeijD5LtnjpiiRqUry3YUiCI/mG8tduoptnhAgX6FDALj6AkZ4/vADgkIjA2v08c7/ihHCa15rnJHDUMKVQwVbFfgumg6x1Lws+sCNTjVGsgrFruK8xyGeX6HqO1xkPAdLKkV7zKMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS4PPF0BAC23327.namprd11.prod.outlook.com (2603:10b6:f:fc02::9) by IA4PR11MB658299.namprd11.prod.outlook.com (2603:10b6:207:112::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 20:09:43 +0000 Received: from DS4PPF0BAC23327.namprd11.prod.outlook.com ([fe80::a1fc:97e0:329a:4aa7]) by DS4PPF0BAC23327.namprd11.prod.outlook.com ([fe80::a1fc:97e0:329a:4aa7%6]) with mapi id 15.21.0662.012; Tue, 1 Dec 2026 20:09:43 +0000 Date: Tue, 1 Dec 2026 12:09:39 -0800 From: Alison Schofield To: Dave Jiang CC: , , , Subject: Re: [PATCH] cxl/region: Keep a decoder staged when its auto attach fails Message-ID: References: <20261120181228.1466310-1-dave.jiang@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261120181228.1466310-1-dave.jiang@intel.com> X-ClientProxiedBy: MW4P221CA0006.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::11) To DS4PPF0BAC23327.namprd11.prod.outlook.com (2603:10b6:f:fc02::9) X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS4PPF0BAC23327:EE_|IA4PR11MB658299:EE_ X-MS-Office365-Filtering-Correlation-Id: 651354b6-e73e-4a11-5579-08df4fe70997 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|23010399003|11063799006|261009223027099003|18002099003|22082099003|260925021311599003|260925021911599003|260925022911599003|10067099003|56012099006|261028144727099003|261026121527099003|261026140227099003|261022105027099003|261021121427099003|261102123227099003; X-Microsoft-Antispam-Message-Info: PQllh0NRPDqYpTEEH50YF3/HjThIp2NU7CRgPwqaqY5u1AEK7wK3JnNtA5r054yFZSQ98RPXNUEpeExqubge0nyhvS5nb5ah4Dew/Xoz5jLElvOAn+/KLDoLF2RsbdCBfZEYVouEs2PTS9eY7KN7vLSTKTil55TmmXdaBY1tl5D47uM07BWjDf8i1Ia6bS7fL2Njj1BLmlKTamerzv+uB1c2/UqrzuREIRd0chlUdmRg9vPhQDUazuhuczBfQFW3Ow4gunRSaKyCePac58eEibF7XZj05BBBu0dhcVzl9pXEUgKm41kLbflTb1bIgO2c2arGaAxxFQpUfPZGkYw8kRwttjSuWpS8NtBf7A25hRpMbmR8ifqG0xAvdCRmKHIgA62DS3fvMw8hq3eRXEIRBUusFIVh8UgzLzwtjG6cD6q+sYaoF7R+pUv4VGhP+M2AGLssEhGQaF4ycySpqD2pgQA7T0c4DuRidl+mLySomYcAkYrdO7nPMzVQmo0In/bmHwm1RWQhHX8JBOSku48vnTkkf/e62eU9sbBCzYunB9YOTTLvRln3QrMHYNkTEheMjAGRFFmcrJKvH83KGWzKeejQjQL7rA85ZMRCVjNCzEynq2QL+Ki5JciR5KeyeDdzi+w4qMno711as5qESpetNAqYWH0dOU6jMXFWPs0Qj/M= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS4PPF0BAC23327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(23010399003)(11063799006)(261009223027099003)(18002099003)(22082099003)(260925021311599003)(260925021911599003)(260925022911599003)(10067099003)(56012099006)(261028144727099003)(261026121527099003)(261026140227099003)(261022105027099003)(261021121427099003)(261102123227099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Bk+KVvJXht0+SJyPMbNSKzrBkoYN1UIsZQ11kM9GDB2Q6sUpN1DAGyfesNA3?= =?us-ascii?Q?no99qHYdBagNeW7Mm9AZqCEcV0nTXtSBYg0fi8No8VcgU3pj/nRxLv51c/v3?= =?us-ascii?Q?+BA1fn5BJG2P3WCxcLBTca6fjiPRUNPSuxpTU2Pc/wq0yLGjV19qREd0c2GG?= =?us-ascii?Q?xG2UULEKYA0PGhH1UF4EFTY1w317h3WiAi/TTEAZWFZ2EFQl8XfFGIoEO5/B?= =?us-ascii?Q?f18FMPb9bjuwnIbkRJ71MY+sERgCZDeMaFEa53kbylYjv3lnEq/BZfG6SUW7?= =?us-ascii?Q?moI5mQ803V4eSWdksWZppzzPcXDjoMuhjhQDx8RlvGWW7vLCsw6ZyBd78Z3D?= =?us-ascii?Q?QwRGmQ9a/xOueL/HnEgT63yGbR5a/ZOZ4lk4JUgaOU0vwTHoo8wkFpwuXqIe?= =?us-ascii?Q?oKA0N7E6wI+tYx2mOF1f6mW6WqVY8XIAas822HGRcdLLSnBnYpXtqvOW7/qe?= =?us-ascii?Q?uk6kxSg9HhByNu52YMicl3nEB6bGoHTD8BzTbNHJ+aDlg9K3tHoq/ymsRY30?= =?us-ascii?Q?XF/3sVPyZE5cRFLou9oAtaEKwrmweMT/uwsQozpBkR68KktN4H90DHD4X85J?= =?us-ascii?Q?z5jmu6/M31zRjS1VnrCdxehopAqdwo/U1mOt2+rap99kVOnDCjaGO3lXuLn4?= =?us-ascii?Q?BF05m/8FyNFhqRfbNltJWTpt3aMN7TgqsCbyO/eJDxENk51AXitK5fWef8uS?= =?us-ascii?Q?H0YBSmq8Faz9XLGb9ZjDSOxjr+xInFPFWZDiq9ydLCOaHz9o+KpsQNs0S9V3?= =?us-ascii?Q?Lzp05cetBx18fWIJ92tjwsm80wIJgCiEbApYFglejelotBvI8CGDOTl+U1ck?= =?us-ascii?Q?63fue67P/m7sJ6A5XHtBkMD1T/+Km+1ZuYZu0yTMhDFeHConijyIMFXBCS/4?= =?us-ascii?Q?cJ1TqkJCtIR6PqQkswZX3TN6S31LgKTdAYq0gzLEBSrxV891/gmad/ncDBH2?= =?us-ascii?Q?WyRvmiPl4J2QkqS82lT583CocDAgiRsikaM+pw9p/cPmqHaGfBJqVCTLJZOh?= =?us-ascii?Q?TFHHuFTB2wiHb1WQg0wv/VVfC3LY8L+u9C9MKDFl+x8v0OuGz5codhfAmdgO?= =?us-ascii?Q?l4qHdtqfNT3WUXIbKK0PCwcVvB+hTLbhwcaAtJJi9atJIZkWlFVCuebkKWjc?= =?us-ascii?Q?Ogq/4JrSjtXIIFV8GYEZgCNDKMwha+16Hk4hTPPx1Xi5hqFJ+mgmiFi0Bwdc?= =?us-ascii?Q?PV0lrDtVY0ehE4EZfri/yjU2Cdwq7ijPG/Mz/1kN32qt5TIrC9zQybXgtYN3?= =?us-ascii?Q?qPg39iLAIO2tgDvc53I8oaOkDDsnFSBO9GXqvgEaBlnbEidGA9jrKqZzN4sS?= =?us-ascii?Q?ndtX1Ck1X8El19yC7aDG5FkCEuUX2jVjtccUANdYjDgjKHcsOLBYbgvCwJep?= =?us-ascii?Q?MUv4uiCL0/l9QgRNcR5eLnG2U3AUyvCnwd9WXdqVmCnqJ5uAxD33UT4hwP2M?= =?us-ascii?Q?vliwuW9jluGcq6lhxFhA15zk0RUlStFqEWq2kFE8hUvkPyuePRCO19TyiXjz?= =?us-ascii?Q?RDNRi1nBiZ82FANvl9gASzB5P7H4Zx/ktoWq4f7VA5Cp66j4hU+t6iv6SJk4?= =?us-ascii?Q?W2fuZ2KOAi+ugPTGvCTcOPial3Gnhh6hK/KuuV0chZ1Tr4lUvxw+vu2/VNhx?= =?us-ascii?Q?91bHNX/qkAD2wAF4ofBWPKG76u083Hbecas+r6Z6Mk6D1YcCO3uzH1OZc/Bl?= =?us-ascii?Q?UOm4j6OD5ZqEtPPJHdkzfA4vrD21Cnjhv+/LE6B3MFi3esSjR3lUQhn6afvO?= =?us-ascii?Q?DDKzG4Xnsi1sqK/25FdeXVMI7SyQNFQ=3D?= X-Exchange-RoutingPolicyChecked: RDYvxb1HyEZUQqExA2y1/DhpdN0pyvRhpUH67v6m8i5jYs6ct1A4dFpLIyUNLF5h+611odtMzU6uxQGY+BuxzLYObkm0CxbKU9s6ftCvwy/lYxvdRZbxtcYl/5/t2/tsJUTiT+tNOeEBKzQS8L4bGnCzsT0r1Z5ol5brI9N5ByySs44FvCjh5qIK1JhiuDYy2F1cxKGEU8OZv87IjhQkTLPR2JVMSrTaOPdAFiZ58r+h2NNM2V9/hgu4Pq76cfrxynwkywfFwxV0kryja/+0YG56P7PI8tz2OCsNiFeYQndDJsuMtqxG7qChALDfJ6e4CCN1ql73Eg/PuGf15H0tAQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 651354b6-e73e-4a11-5579-08df4fe70997 X-MS-Exchange-CrossTenant-AuthSource: DS4PPF0BAC23327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 20:09:43.2827 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9Zk9Kk4qSggi9KKVLXoqe4PmU+hBV6hygkj680M7OKOqqO1hf9CZzZ6C+0MTf9cPaEDxH2mTvdSGKe4Nxhm3lTdGPRZZDQRR3Z4EDjwKMfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA4PR11MB658299 X-OriginatorOrg: intel.com On Fri, Nov 20, 2026 at 11:12:28AM -0700, Dave Jiang wrote: > An auto region lists each arriving endpoint decoder as a target in the > AUTO_STAGED state. Once all targets are there, cxl_region_attach_position() > attaches each one port by port. Attaching at the endpoint port sets > cxld->region and moves the decoder to AUTO. If a later port fails, the > unwind clears cxld->region again, but the decoder stays in AUTO and stays > listed as a target. > > When that endpoint goes away, __cxl_decoder_detach() finds no region and > calls cxl_cancel_auto_attach(), which only removes AUTO_STAGED decoders. > The freed decoder is left in the region's target list, and the next > teardown of the region reads it: > > BUG: KASAN: slab-use-after-free in __cxl_decoder_detach+0xa6/0x3b0 [cxl_core] > cxl_decoder_detach+0x6c/0xf0 [cxl_core] > unregister_region+0xcb/0x470 [cxl_core] > kill_regions+0x9f/0x100 [cxl_core] > > Put the decoder back in AUTO_STAGED when the unwind leaves it with no > region. Hi Dave, I do see how this fixes the UAF, but... NAK on keeping AUTO_STAGED. Dan's original fix used it to gate the lookup that indexed the target array by cxled->pos. Ming Li's commit cbda6a2c2bec ("cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach()") changed the lookup to scan for the decoder pointer, so the target array itself tells us whether there's an entry to remove. We can drop AUTO_STAGED and run that lookup when an AUTO decoder is unregistered with no cxld->region. That covers both a decoder still waiting for peers (Dan's case) and one left in the target array after an unwind (the case this patch fixes). I have tested out what I suggest w another patch, that I'll post next. -- Alison > > Fixes: 87805c32e6ad ("cxl/region: Fix use-after-free from auto assembly failure") > Signed-off-by: Dave Jiang > --- > drivers/cxl/core/region.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index a048bd5c06cb..f1083976592f 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -1830,6 +1830,14 @@ static int cxl_region_attach_position(struct cxl_region *cxlr, > for (iter = cxled_to_port(cxled); !is_cxl_root(iter); > iter = to_cxl_port(iter->dev.parent)) > cxl_port_detach_region(iter, cxlr, cxled); > + > + /* > + * Attaching at the endpoint port moved a staged decoder to AUTO, and > + * the unwind above cleared its region again. It is still listed as a > + * target, so keep it staged for cxl_cancel_auto_attach() to find. > + */ > + if (cxled->state == CXL_DECODER_STATE_AUTO && !cxled->cxld.region) > + cxled->state = CXL_DECODER_STATE_AUTO_STAGED; > return rc; > } > > > base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3 > -- > 2.54.0 >