From patchwork Fri Feb 10 09:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13135556 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07899C64EC4 for ; Fri, 10 Feb 2023 09:06:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AD816B0121; Fri, 10 Feb 2023 04:06:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E8876B0123; Fri, 10 Feb 2023 04:06:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68A0A6B0124; Fri, 10 Feb 2023 04:06:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2ABFE6B0121 for ; Fri, 10 Feb 2023 04:06:18 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DFBE0C1355 for ; Fri, 10 Feb 2023 09:06:17 +0000 (UTC) X-FDA: 80450800794.22.87AA8F2 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf15.hostedemail.com (Postfix) with ESMTP id C4FA3A000F for ; Fri, 10 Feb 2023 09:06:15 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=JSHxYX70; spf=pass (imf15.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676019976; a=rsa-sha256; cv=none; b=3DWY6dSnti4KsRY39A7WfuJlduwEZb/0Ge7ovDc9TM9PV6saGGstWcBECM4KAYDvn20UVY obbVuKrKB92+1cvWZMg+gm1zE9unjK06EPXkvuPbVAbjuHy2b2I7ZY30CERDvkFSI4Nw2D Atb1ZMPfUyV9K24TWJvZ5YnSFTdLqBM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=JSHxYX70; spf=pass (imf15.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676019976; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mfUEpWzaCwLjRg/Zjh5TXxp63MmUw9zTaXLKAaLX4Xg=; b=CXFAAxQv4kWgbY4dm2oqCMZdfxn/Y3OQiaGM8iQ8pczBbAgdKVezesu21saV80DwTtgBeB zVNPLXCPZ+iZ2m+eGQY53+Mn1qdvRykrGR/TmCIyo0PGRxP6btrS6IHrUoYiGm4EzGEl9w rIiMtJFp1CvKa5hb4JiNsd6794vYXhI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676019975; x=1707555975; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fhaP5oPHi1onz90GhrHdXiTbxa3g3s/6YpVTWY4pO0U=; b=JSHxYX701Clq6zXbr/KYF3yvV9vve2AyF2a6BgVEk7+OkN08K/bRgRhW XBfbQNhg/zp37M6Tn409rIWiPwpoI9dlVkIht5iTBbws5MdL5HZBDBrtX d+he9BFR+5kMxxFKVD1chUYv5VNESK+WN1ybfTm1p1sKZlBV4g8CXlyWg lmbhnIrVIR3cgGcM6597h9CDlpP2rhWoxgRoipt7Cs/29HPc+tmb/mo42 QAVQswxM2bkVgYK9zvSOocOt39wCtZlHZYHMKZGMxUZ7LLxi0H4R0WS9O 2z5GIKpR+rl1gYlpFyhB4w9eQDmPuU7iZ1yVvZmyihQhdFt5db66f+tcs g==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="416600066" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="416600066" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 01:06:10 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="669930260" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="669930260" Received: from hrchavan-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.46.42]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 01:06:10 -0800 Subject: [PATCH v2 08/20] cxl/region: Cleanup target list on attach error From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Jonathan Cameron , vishal.l.verma@intel.com, dave.hansen@linux.intel.com, linux-mm@kvack.org, linux-acpi@vger.kernel.org Date: Fri, 10 Feb 2023 01:06:09 -0800 Message-ID: <167601996980.1924368.390423634911157277.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <167601992097.1924368.18291887895351917895.stgit@dwillia2-xfh.jf.intel.com> References: <167601992097.1924368.18291887895351917895.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: C4FA3A000F X-Rspamd-Server: rspam01 X-Stat-Signature: h6zyx4gbkiro3h5tm9tm67b5irziaf11 X-HE-Tag: 1676019975-141546 X-HE-Meta: U2FsdGVkX1+zBwP0JGlKKM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q7A3sIQVUecgtYZadzO7nmZ8Gf2lQybTMt63XzVrZcp1MZAmqV8va9iUEkO8ReI4iAvsm7E86irVaprsEi8v+0yWZQ5afYbgqIFpwuckqS6vgQmdxaOTFE72+n8j5Ri/WgvprEtmWghGQ/xY32I2IM+X82lo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000449, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Jonathan noticed that the target list setup is not unwound completely upon error. Undo all the setup in the 'err_decrement:' exit path. Fixes: 27b3f8d13830 ("cxl/region: Program target lists") Reported-by: Jonathan Cameron Link: http://lore.kernel.org/r/20230208123031.00006990@Huawei.com Signed-off-by: Dan Williams Reviewed-by: Jonathan Cameron Reviewed-by: Vishal Verma Reviewed-by: Ira Weiny --- drivers/cxl/core/region.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 040bbd39c81d..ae7d3adcd41a 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1347,6 +1347,8 @@ static int cxl_region_attach(struct cxl_region *cxlr, err_decrement: p->nr_targets--; + cxled->pos = -1; + p->targets[pos] = NULL; err: for (iter = ep_port; !is_cxl_root(iter); iter = to_cxl_port(iter->dev.parent))