Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1526177rwj; Sun, 18 Dec 2022 09:53:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6OCDS28hk8AhCqvfjWZicsbTKkTgrS1ElVZv4/GajbNK54zwSHKTEsudvewV4V7cCvG6gP X-Received: by 2002:a05:6a20:1324:b0:ad:f2bf:bc50 with SMTP id g36-20020a056a20132400b000adf2bfbc50mr18779730pzh.13.1671386035234; Sun, 18 Dec 2022 09:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671386035; cv=none; d=google.com; s=arc-20160816; b=TxF7Lm4H+3W/RpOGT2jmH4mIvCUduNks+v1OsGwyWu6gQEiYN+z7xy6sSR/EZYT7uR uyPVevt/qu+Mpx6MrimUnQxu34bqTk6mVqIPH63KB4HvtQPitjhvrr8nWENaPbYPx09M Vzpfjj1DeCnk7S1EpabTufgfhsQlQKjP1DdSZE80dXX3YhaAqe0qfJObWGOxQyo1OpsK CufICWiGI827HJAHegdWGBB5uASWMgOC/Hw2zW2DFyf1PHNzij7wk+XQxCbeKQoYdwkY AKQG/P5OdaRqJOtfVZNk6tr1KLS52xfp2jvMIOBGS5XUpuxexmLQdDWXtkbV6nVhqiR7 I/aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+rfzljfgEXRh+/e2wW6BmpYeWg0TkWyJQN+IEpsYE4k=; b=GV/Ro2FpNoiwFxLJl+TeXqrnCYtwHpXX7Ax61irkEAH+h6JO6FhU1nBYCiD/zGxtcT NeSg9q5XPNDaozikrLlIDPuPF1M9PzZEBqMfTcjQ1ZXOh0bYwewOmflE9++k1b/vDsqA abM1tMKDtYMpIFX2a/Cs0SwGSgWGEzp3Ucx7apyfSn+S/tCHZnEyO8Dh2Ldl7g5Zy2yG 62Pqysua6nzqPIZqFADiT0/5VwWEMAWVhoACajVnybAbWgzIRzl/X/l66IS9PlDc9wU8 /usZR5Jsrr9T3R7Vu54I5vVILvy+giOQAn65Gdy65geCzRyYsZIDoM9Rk2kOtNef2jEA w3UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nq02SClm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f34-20020a635122000000b00477b4b68f09si8633208pgb.258.2022.12.18.09.53.46; Sun, 18 Dec 2022 09:53:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nq02SClm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbiLRQpz (ORCPT + 70 others); Sun, 18 Dec 2022 11:45:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232449AbiLRQot (ORCPT ); Sun, 18 Dec 2022 11:44:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB65C10047; Sun, 18 Dec 2022 08:16:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D73E7B80BA4; Sun, 18 Dec 2022 16:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9B01C433F0; Sun, 18 Dec 2022 16:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671380157; bh=EMGTs2CiTzTav5yWj5PLgl4miUln49624MWwLzHyE5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nq02SClmnWa91IIC7gBAweu1gc/C9xYbYhgafmp20aPHOJl6oBf4wKLs/5wOOUVG2 b5Rv4yoLxoPxO/HBgfsYCnORkb+T9BthzRs9r4W6r+ve5IyXI6fF1KwrT2qMgLsvV3 lPWPBpsTDSukmkPy5MrLMQzTEGPmLXZvqHKvJhng7GLMBjuL0uVYT8QmrdP5Kt8niI +nqG0TqjfgRjXF2rMLmLcPfqee7L1JJC+kUCzvOzkKEyIlGlFqC+GskLM+eyQIdZMd cg5TezP74CDzuPfMYiEgk1mtDMuWdQaUmhj79O9NjY8RxERu8N5KIn4VruDCQuNx/K qJQPEhzrxA+FA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xiu Jianfeng , Patrice Chotard , Stephen Boyd , Sasha Levin , mturquette@baylibre.com, avolmat@me.com, windhl@126.com, linux-clk@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 46/46] clk: st: Fix memory leak in st_of_quadfs_setup() Date: Sun, 18 Dec 2022 11:12:44 -0500 Message-Id: <20221218161244.930785-46-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221218161244.930785-1-sashal@kernel.org> References: <20221218161244.930785-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiu Jianfeng [ Upstream commit cfd3ffb36f0d566846163118651d868e607300ba ] If st_clk_register_quadfs_pll() fails, @lock should be freed before goto @err_exit, otherwise will cause meory leak issue, fix it. Signed-off-by: Xiu Jianfeng Link: https://lore.kernel.org/r/20221122133614.184910-1-xiujianfeng@huawei.com Reviewed-by: Patrice Chotard Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/st/clkgen-fsyn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 164285d6be97..ba18e58f0aae 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -1008,9 +1008,10 @@ static void __init st_of_quadfs_setup(struct device_node *np, clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, datac->data, reg, lock); - if (IS_ERR(clk)) + if (IS_ERR(clk)) { + kfree(lock); goto err_exit; - else + } else pr_debug("%s: parent %s rate %u\n", __clk_get_name(clk), __clk_get_name(clk_get_parent(clk)), -- 2.35.1