Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4792540iob; Mon, 9 May 2022 01:34:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGP/6l1ZhKyDDlxKHzEDYoYmH7nTW9sLccDgipkcLk5A6qw3LuHNeY2ySV4qXVIMkMWl50 X-Received: by 2002:a17:902:ab96:b0:159:1ff:4ea0 with SMTP id f22-20020a170902ab9600b0015901ff4ea0mr15451703plr.60.1652085280395; Mon, 09 May 2022 01:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652085280; cv=none; d=google.com; s=arc-20160816; b=rZvRJiIJA4e9AkQOKPtceRB+Ce2UwOZiWkNpoDKComs4roUH8PNhiZLJxxgdtUirXD lLMZHTd5o5eQsjuezsDz5PR+8FegGFheVesJBzUf+6u+JdhU8KjAFVX4juPUxepmYMHu c3R9/LHLb07UDV+lK3m6RArIeImKoNR91k7i8kGvjWq/2ogXP9RJ0ZkUqjNw52tH11Ki BbOtble4lacOA1pwBJ0RKNtHUoBhNLUUrg0fZ41u7lSNOPnbztn122/4hONzzLZ1Czqa +ShAgQ1Halo82OWpSzeUtB/ic2v4PXrHEXY1VHb9suK7XrP/+CLi2rOJUh/yCzVsZ9IB A0vQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3CGdFwPOo3e7WJmU8BTP14UbLLsFeslizy73BWBXecA=; b=m7KUZM8778iXMf0Oh2g8q+mwky2gfESIN861+jSOl/JFPqARf2PvEq4jSlvMnod9Vj yyxTQQv8tHqJQwauPh7+UamImipPuJrfSkJqbPMrxgbUcxdiU+4Q0XR1pTMxppl6/vsC vridSeCE0cASmcS0vocUTnvlmPGt8onCLiXSGbwzG2iBc1JDm1oM5yRpow2PBHxkvpe6 yGtUV2jzkGct03uVXRt0M5snr7o1GW8vLoOSPNcxb4dtLsX+WpLuaqNbFhFK6jz7iOMP lIViwIU59Y6du6TFS4/BhRiE6oE0C7vzZqwdin+I4p/DNYJnvJI+snShlrqoyhtarqMM 8Q6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KukplC2U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 8-20020a630008000000b00398009192c9si14031894pga.869.2022.05.09.01.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 01:34:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KukplC2U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D33B1A811F; Mon, 9 May 2022 01:17:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356624AbiEDRST (ORCPT + 99 others); Wed, 4 May 2022 13:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356099AbiEDREx (ORCPT ); Wed, 4 May 2022 13:04:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B7E50455; Wed, 4 May 2022 09:53:49 -0700 (PDT) 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 C5679B8279F; Wed, 4 May 2022 16:53:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E1FC385A5; Wed, 4 May 2022 16:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683227; bh=IiuLVqn+41hK/TvtV51P7ny7tLaJWsoNCR7nCU1SY98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KukplC2U0TZ6FMtV794VfOiEzd24mYzXeww5Q/J43MsDrY29RDxevypEHk3Nujlct njDZF0qq3t7U0sQuPWfa/Jgh25c695dXl92GtHeD0YoFJPt88hfG0K+4zyaXC7lFOG zyQvRT+JVTNOK0806JdvnsaLNXJbKsP1R0winnUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaobing Luo , Samuel Holland , Viresh Kumar , Sasha Levin Subject: [PATCH 5.15 092/177] cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe Date: Wed, 4 May 2022 18:44:45 +0200 Message-Id: <20220504153101.347699471@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Xiaobing Luo [ Upstream commit 1aa24a8f3b5133dae4bc1e57427e345445f3e902 ] -------------------------------------------- unreferenced object 0xffff000010742a00 (size 128): comm "swapper/0", pid 1, jiffies 4294902015 (age 1187.652s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000b4dfebaa>] __kmalloc+0x338/0x474 [<00000000d6e716db>] sun50i_cpufreq_nvmem_probe+0xc4/0x36c [<000000007d6082a0>] platform_probe+0x98/0x11c [<00000000c990f549>] really_probe+0x234/0x5a0 [<000000002d9fecc6>] __driver_probe_device+0x194/0x224 [<00000000cf0b94fa>] driver_probe_device+0x64/0x13c [<00000000f238e4cf>] __device_attach_driver+0xf8/0x180 [<000000006720e418>] bus_for_each_drv+0xf8/0x160 [<00000000df4f14f6>] __device_attach+0x174/0x29c [<00000000782002fb>] device_initial_probe+0x20/0x30 [<00000000c2681b06>] bus_probe_device+0xfc/0x110 [<00000000964cf3bd>] device_add+0x5f0/0xcd0 [<000000004b9264e3>] platform_device_add+0x198/0x390 [<00000000fa82a9d0>] platform_device_register_full+0x178/0x210 [<000000009a5daf13>] sun50i_cpufreq_init+0xf8/0x168 [<000000000377cc7c>] do_one_initcall+0xe4/0x570 -------------------------------------------- if sun50i_cpufreq_get_efuse failed, then opp_tables leak. Fixes: f328584f7bff ("cpufreq: Add sun50i nvmem based CPU scaling driver") Signed-off-by: Xiaobing Luo Reviewed-by: Samuel Holland Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index 2deed8d8773f..75e1bf3a08f7 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -98,8 +98,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) return -ENOMEM; ret = sun50i_cpufreq_get_efuse(&speed); - if (ret) + if (ret) { + kfree(opp_tables); return ret; + } snprintf(name, MAX_NAME_LEN, "speed%d", speed); -- 2.35.1