Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1011614rdb; Fri, 19 Jan 2024 05:47:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7HSGYVXS8z3mBlD0+5MXy4VXOOrPU1+lScHKGJOmC/2WATfBwqFeYONOrvCkj3d8yPtSU X-Received: by 2002:a05:6a20:daa0:b0:199:fe49:8ff9 with SMTP id iy32-20020a056a20daa000b00199fe498ff9mr2676694pzb.2.1705672050616; Fri, 19 Jan 2024 05:47:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705672050; cv=pass; d=google.com; s=arc-20160816; b=Wpb2KeC1o1Y+7Q0jZ03GLh6UUzR0UmxzYCpma8VrYPRvEEW3k/e7gQ0iXISu6tsAka LXDz+3oH5jPL6nEJEDKe1pFrDqyZiQV6Jsz4dtXsvzWFXixAe1hTH7rYSO24gv5UBi/b 7w2dS5KdyQmyR8HESvCRTtMwB2jdU/XcDTziY8Mt0vEGslBCFABwzU7aLbtnkT1GLbeC WyrlSdqifeHEvjDZDPPks/xWPeUil9orlhZIND3UUnbUJT8ntMcuE9BvArkvb2R5TNC9 WhI2qZU43okydGBJEj5kYT8i1S9hAQWnc8fTVKa4KVF4eGWwHK/K0Lc7eO2bC+HmxfDu tQig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pb+wyOj6Dbvy4yGUrw9qIxrmhYRn41F9LnYuKQBWMD8=; fh=IZuP5IGbyaKFqIW3GqM7nAGxP7ZU99SIwHUr+nV4KwI=; b=CQqqq5VaeKNevydk9eBTXq5tkUqPl9OpT3yv6YQN2fkuRkmtBIwdrvpxwHFgxZbTqf qW17WtQ80cwVDytMdJkjYMpwWHffmm8+az0kDzcXxjOwFilwspO3rOJIfo0J1GTRwkpa ObywYSyUEu+aRV3exHbOZnMdbIsNqQvxI1Je2IzfeLVGzEwISQG0HRo+zESNnrozN545 Ktr0MAwMhG/3ZH3JbD1AhWjI1LNsR5p1wBNUIR5598sz9Nns/uWHBOSex3+dF7k3/vAt rAE0GjsS8UkaSdzikdkOnQZBjI3o2AaiGDa1TU4EsD/WNEtB7SzYI4k7LQ+0F6BY7Lr6 wY2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="YLHRE/Q2"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-31216-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bz42-20020a056a02062a00b005cdfde5e3f3si3668045pgb.250.2024.01.19.05.47.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 05:47:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31216-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="YLHRE/Q2"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-31216-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1120CB2472F for ; Fri, 19 Jan 2024 13:46:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D9FF53E00; Fri, 19 Jan 2024 13:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YLHRE/Q2" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A44952F97; Fri, 19 Jan 2024 13:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.31 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705671977; cv=none; b=KM6Ixt2u+ffkELMHLj7BD6AImQbISsmY0c+qZu5SLo41yAUd8zItAgkf8+1qGz4R4XbWqnVbvMcrkOuu69w5FjIqDxpwqBk1KQto1m3CxIE9lm791ElFIGwXS6/A9baGqPFi3DZFBajIfK6bWjoty2gCLBFAWjIR+9JGs+Skvzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705671977; c=relaxed/simple; bh=tRIwU7gwsDz+zqq2CsA81lk0Upeoqq9BY6wWzJVRuqU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eqoy37I9yBMTuDrJ2X16c8GuO8aSVDIEs7Lu93JIrauNwzckkbr/eR71R89UWImyqrceD6LoYjoCRqYkmjyUnid6jIONTRgQk30oJ57HHsAqSXqdOAuWrQabQW9uVX4e/6r2vXpUCYLiRFqKxWIa2dhvuNzbAUOA7LHWNz3UDvA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YLHRE/Q2; arc=none smtp.client-ip=134.134.136.31 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705671976; x=1737207976; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tRIwU7gwsDz+zqq2CsA81lk0Upeoqq9BY6wWzJVRuqU=; b=YLHRE/Q2MMv7Xh0M04+hwbOiozvm2CqBJq72FO+Q7wxX5zIFUF6w2SrB Ci/dx485PupGamu7ZtEY3YDDaLzEhPO5PHOEkdrvNdZVLELBsdjdqo0rm 3GN2oPVXRwkmI4bEiIuz6moINXZ7YhTgR0D97PE6U64lR+ngLD6nUpBO9 p/FOBzKnRszkuDkCgnrXq9Dskwcu0XipjPAbu/OOUeNTJtuF/mjvtMRoa 1EVRD/GT8qqxml+zuVjX1s7aBVCn2QzBCxAcAyZ/NYg2b5udqdEhmDTBV dP6M5jirbmcmbGHwI83TorJ5j0vRHF+xjsFASV1njQRuq1jeRCTQg8Lz/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="465026897" X-IronPort-AV: E=Sophos;i="6.05,204,1701158400"; d="scan'208";a="465026897" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 05:46:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="788360387" X-IronPort-AV: E=Sophos;i="6.05,204,1701158400"; d="scan'208";a="788360387" Received: from amlin-018-114.igk.intel.com ([10.102.18.114]) by fmsmga007.fm.intel.com with ESMTP; 19 Jan 2024 05:46:13 -0800 From: Arkadiusz Kubalewski To: netdev@vger.kernel.org Cc: vadim.fedorenko@linux.dev, jiri@resnulli.us, davem@davemloft.net, milena.olech@intel.com, linux-kernel@vger.kernel.org, pabeni@redhat.com, kuba@kernel.org, mschmidt@redhat.com, Arkadiusz Kubalewski , Jiri Pirko Subject: [PATCH net v6 1/4] dpll: fix broken error path in dpll_pin_alloc(..) Date: Fri, 19 Jan 2024 14:43:01 +0100 Message-Id: <20240119134304.576956-2-arkadiusz.kubalewski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20240119134304.576956-1-arkadiusz.kubalewski@intel.com> References: <20240119134304.576956-1-arkadiusz.kubalewski@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit If pin type is not expected, or pin properities failed to allocate memory, the unwind error path shall not destroy pin's xarrays, which were not yet initialized. Add new goto label and use it to fix broken error path. Reviewed-by: Jiri Pirko Signed-off-by: Arkadiusz Kubalewski --- v6: - no changes, bump the series version drivers/dpll/dpll_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index 1eca8cc271f8..c08772ee9fd6 100644 --- a/drivers/dpll/dpll_core.c +++ b/drivers/dpll/dpll_core.c @@ -441,7 +441,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, if (WARN_ON(prop->type < DPLL_PIN_TYPE_MUX || prop->type > DPLL_PIN_TYPE_MAX)) { ret = -EINVAL; - goto err; + goto err_pin_prop; } pin->prop = prop; refcount_set(&pin->refcount, 1); @@ -450,11 +450,12 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b, &dpll_pin_xa_id, GFP_KERNEL); if (ret) - goto err; + goto err_xa_alloc; return pin; -err: +err_xa_alloc: xa_destroy(&pin->dpll_refs); xa_destroy(&pin->parent_refs); +err_pin_prop: kfree(pin); return ERR_PTR(ret); } -- 2.38.1