From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E25C7C636D4 for ; Fri, 10 Feb 2023 17:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232422AbjBJRbh (ORCPT ); Fri, 10 Feb 2023 12:31:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbjBJRbg (ORCPT ); Fri, 10 Feb 2023 12:31:36 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F65773958; Fri, 10 Feb 2023 09:31:36 -0800 (PST) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PD12h5vcvz6J91l; Sat, 11 Feb 2023 01:30:04 +0800 (CST) Received: from localhost (10.81.210.211) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 10 Feb 2023 17:31:33 +0000 Date: Fri, 10 Feb 2023 17:31:32 +0000 From: Jonathan Cameron To: Dan Williams CC: , , , , Subject: Re: [PATCH v2 08/20] cxl/region: Cleanup target list on attach error Message-ID: <20230210173132.00003647@Huawei.com> In-Reply-To: <167601996980.1924368.390423634911157277.stgit@dwillia2-xfh.jf.intel.com> References: <167601992097.1924368.18291887895351917895.stgit@dwillia2-xfh.jf.intel.com> <167601996980.1924368.390423634911157277.stgit@dwillia2-xfh.jf.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.81.210.211] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, 10 Feb 2023 01:06:09 -0800 Dan Williams wrote: > 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 > --- > 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)) > >