Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp272899rdb; Thu, 18 Jan 2024 03:13:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3BvR05s2fKPHAytsW7Dd42GgJeleAZfT9KeGC4Ji3hDat8j0jhXR+lnNf5UZ70XsOh8dF X-Received: by 2002:a05:6a20:7292:b0:19a:411a:89bb with SMTP id o18-20020a056a20729200b0019a411a89bbmr769787pzk.50.1705576383340; Thu, 18 Jan 2024 03:13:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705576383; cv=pass; d=google.com; s=arc-20160816; b=FUfn0A2rgTgRAhnY0FlgCfOgaz57FTfYOSw3Lix5tQZxU6zG6hgM8OWHxhLQeVZ2eL tmGAVSvQn+mGDejoW14hGoNE2FNOyUPyDEec8LTohHrcms9YadVoKJ9oYB/iLzE/pdL0 uhYWSzIW/O9vc/n7SG+lDNXDeuH6hyDDGU79o89Lu9kbF5ds2DOroscOZthIy9no0s9M +LAvoZq6NSNKLTkXb2d/dlua3qglCmu4XQRPjbXUPCFCBV6Oe/7FxuizRCJFUMSSq3h7 JkA4VyBTjnjCVMuSLYfOPa77UGWZv4RISAp1YR3Ujuc26SNSjTs/KKLtz7SpEQk1uQ3m 9aEA== 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=L2sehve6nLOa2oRayY1+bMmdrkqcayQjX9khEiosJq4=; fh=vc72cqMtTxQAMyizXvYN6Azr7Hu29gAS/vKaMF1SFgk=; b=KY3lLLl07VO4kvgPDpJWH0xwqUSe9q5+4eRUa5selZ1w5XthyAVJ9Y5jQc4IS7EkfG 2E/V/736TvOr68Z0tbrDqvCk2Dwfl/KNaf38KC3nb9q36eL8k76ZkYxP3PXS1FNlDRCq LeA7tbLZNALiek6dpslkbkM/lKD8Vzn8EMeDZ9hrOYeepzk95gNoyutnlz6DxYj3Mtoy dM75cFwwBxBP8YhyRCuEC7T5H1Dq8I9r5Fplx3Px2W15nXRI4r9o8+MXJzfocAk/UXhh O6FUiVYvijfQhpUCeUrOPa6yRmttP3qX9tiJlDYr/k0mCTnpUdWWp1PZJeLukiSmO60e C4tw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="chmEHK/p"; 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-30030-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30030-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o12-20020a656a4c000000b005cde435ff91si1319724pgu.878.2024.01.18.03.13.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 03:13:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30030-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="chmEHK/p"; 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-30030-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30030-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 6F280B24C27 for ; Thu, 18 Jan 2024 11:11:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2627524A1C; Thu, 18 Jan 2024 11:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="chmEHK/p" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) (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 C906C2377B; Thu, 18 Jan 2024 11:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705576234; cv=none; b=cYTi6FQhBsgpBaB6W87yu1X69f9VAR/kBDV7ikCDFuEpCh/7mazWGvIcxQ29jyHpfRHaBMVw07W9rPbc94PXeJPgdua26F0y66efygU8nr1ojXR6rKByF/R1+uTGsbM09VpB7BI/n+LCcrO/WzWxZ1sfFattfqSBieTgXfEAw/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705576234; c=relaxed/simple; bh=+Xu20dORa8ppOptEVErsUmVHtjvUkyabhTNmd/IQJPs=; h=DKIM-Signature:X-IronPort-AV:X-IronPort-AV:Received:X-ExtLoop1: X-IronPort-AV:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; b=ZNHKcE2XPxfNH0Z49wegtcmnhMdPBmXQ9e3i4MA+U9piFhJP3Wr/SipEumaYzWPlHYlRy4R0X1aZWcM+6bi4g6HjFdEN/TH9s38fnUsnfJPfnDuBConT6VDcfECMiR8vu5QUEjY5gpLAJT2HSoWJ1Swprc5Q50mpbotpSYWEPSQ= 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=chmEHK/p; arc=none smtp.client-ip=192.55.52.43 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=1705576229; x=1737112229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+Xu20dORa8ppOptEVErsUmVHtjvUkyabhTNmd/IQJPs=; b=chmEHK/paJyYJw6lqAnZ8kJ854ofM7eUynxjBMTl8vOzCYNKgGzzyba+ KrRsRGWmAtjbCkUrfsBdVcBxbJYxOfovdW6deBsqsR2KxfmEvBoiE8yKT 1Bd6mHG24IKyAtHUjRU2ZhWq7q7Z/VkrsyLrpqlO0XOTAjV+vglqLSgUf CYcZC9NztUEUc3aRMpHq4RyzK2y6bdO8UEKt4GfCepzCU/53iYdoAEx2J lvZGGNQrkPanYXYYuLi9Qd2PfkN8bpjevotcoPoNO0Ah4MvptBNP7aTx/ DHIgNRVyZU7dwrBYOOppvj997A0F4Z86PnW0Biv2yNcXXGsYnrjZMPZQ0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="486571176" X-IronPort-AV: E=Sophos;i="6.05,201,1701158400"; d="scan'208";a="486571176" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 03:10:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,201,1701158400"; d="scan'208";a="262419" Received: from amlin-018-114.igk.intel.com ([10.102.18.114]) by fmviesa003.fm.intel.com with ESMTP; 18 Jan 2024 03:10:27 -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 Subject: [PATCH net v5 1/4] dpll: fix broken error path in dpll_pin_alloc(..) Date: Thu, 18 Jan 2024 12:07:16 +0100 Message-Id: <20240118110719.567117-2-arkadiusz.kubalewski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20240118110719.567117-1-arkadiusz.kubalewski@intel.com> References: <20240118110719.567117-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 dpll_pin_prop_dup(..) 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. Fixes: 9431063ad323 ("dpll: core: Add DPLL framework base functions") Signed-off-by: Arkadiusz Kubalewski --- v5: - make this patch first in the series, previously was fourth 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