From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A33D43446C6; Tue, 6 Jan 2026 17:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719710; cv=none; b=asnwvKoQZgWYJb63oXoO0K7FWybv2iHyNYEtwvTGrkGEDF01HmYA5i8hBF3/u5ijhe54mb1eSYemhn5qLZlpZUSxUP3idDfh3uuxyk4CLMng+XIF2oW1MamhymtMGe4c3Yun4kBbbMKfTIS2so5a95JrtBvVmnpInaRBSSi2nG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719710; c=relaxed/simple; bh=+fiEAuOEc1qfSCJK4We9+ZVKFRqHZrsZT9Frqo9eGBI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S8Vwy6q8YLTPlqOcwfTL8DwhSND5EvOWiyka3zmHmhbwAmZ6Cre/NOffw+sxiB6Q1CwRM5Cg/juPN//CgDPgmMTvtjoCj6lhzurduWbWpTWAKU2rbrvFTDgheEdTFDVMuzhM4TFSx/zFpsX8Fht56WUEits90BHGyWUe1JgaOZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jU9HMY/D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jU9HMY/D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10516C19423; Tue, 6 Jan 2026 17:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767719710; bh=+fiEAuOEc1qfSCJK4We9+ZVKFRqHZrsZT9Frqo9eGBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jU9HMY/DimUp/1Kox+MJPDbBn/+IRTbVrQk3kfaFa7/yY/B9fsgx4TLShTq9ehUTg fvQA9898Nso441lGHdtxDWTdajiWZpvEAsfum5WixZ08hMhg667n9hwAiphB+ENi/N KDRBkEumzGPca/y0YKNGlfdZtD71TcEr11f6Ahcw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shuhao Fu , Viresh Kumar , Sasha Levin Subject: [PATCH 6.12 017/567] cpufreq: s5pv210: fix refcount leak Date: Tue, 6 Jan 2026 17:56:39 +0100 Message-ID: <20260106170451.979588178@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106170451.332875001@linuxfoundation.org> References: <20260106170451.332875001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuhao Fu [ Upstream commit 2de5cb96060a1664880d65b120e59485a73588a8 ] In function `s5pv210_cpu_init`, a possible refcount inconsistency has been identified, causing a resource leak. Why it is a bug: 1. For every clk_get, there should be a matching clk_put on every successive error handling path. 2. After calling `clk_get(dmc1_clk)`, variable `dmc1_clk` will not be freed even if any error happens. How it is fixed: For every failed path, an extra goto label is added to ensure `dmc1_clk` will be freed regardlessly. Signed-off-by: Shuhao Fu Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/s5pv210-cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index 76c888ed8d160..d2fa42beae9c2 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -518,7 +518,7 @@ static int s5pv210_cpu_init(struct cpufreq_policy *policy) if (policy->cpu != 0) { ret = -EINVAL; - goto out_dmc1; + goto out; } /* @@ -530,7 +530,7 @@ static int s5pv210_cpu_init(struct cpufreq_policy *policy) if ((mem_type != LPDDR) && (mem_type != LPDDR2)) { pr_err("CPUFreq doesn't support this memory type\n"); ret = -EINVAL; - goto out_dmc1; + goto out; } /* Find current refresh counter and frequency each DMC */ @@ -544,6 +544,8 @@ static int s5pv210_cpu_init(struct cpufreq_policy *policy) cpufreq_generic_init(policy, s5pv210_freq_table, 40000); return 0; +out: + clk_put(dmc1_clk); out_dmc1: clk_put(dmc0_clk); out_dmc0: -- 2.51.0