Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2139221iob; Thu, 5 May 2022 16:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxROYzPxfAt6d6P25ruioiDlZHjWBaJFsNC5NrsncjJijaHWFDeoT/wrQdFYYAaOvAeue5P X-Received: by 2002:a05:6402:4396:b0:427:f2dc:b11 with SMTP id o22-20020a056402439600b00427f2dc0b11mr758913edc.298.1651795140196; Thu, 05 May 2022 16:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651795140; cv=none; d=google.com; s=arc-20160816; b=vKLgfyJFJdw41K9MjJzePrV9onGAcDcQOe+B76yrhQUQVFKxSB4Ak1/GcFd8jLOxmt Cd3T0+nht4DMfIWz6bC1/8bu10BJeXE54TI0cwbWR5YDCYbHLtNqNs9Qu/PkZmwj+24g nfYLGkMSwt0frWvioblXWD3ch3JVFTa7D7QlgsdDAKMFYhXLRd8xbWvkCdXfLRE74csm 4V2ktX7uLI0Xw6O9TS2vxCl9qfZXqg48nI7CocE/OQScrcEk2WE2FkbFgPbxYyxuO0U8 tN3xGjYFonY42h5zXy8YYVsgwzLIhTCkICAE5WqyeKXi5+6tnJYo8+h1V6WxWPhzX1ll FNeg== 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=U1z7SI9M15L9SsZuYDt8jpH5EXOv0e7k6PxfZecK3EIeR8xGQk5WzIDxbq3BNLm/eG RlmSY2n3GHnRMfGSBXexWs7DzCPB+FA5QSPBrgMW9DrxNK3NA+bsRX4f5bH6Ht845gs3 BvhbZhYvUWNIF2Dh++F9z03AB0TTniEBZ3hax2I1YKpSUJAIkK9fPBYb7Vm69smRbJPO geyI6fSQiJmQRNru9DCISyX/oEuXPaxjtWzucIffhIlzo6TYc/ixWRVGly+9VwC0/J38 IosPJ2XKgJ6/HMwnVZSXHO6q4bCBNJFXSB+1nOwBF0N/UROGA326TmyMgHnTpUGdSalI 1KPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dqilBcIr; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a056402400600b00424085b80c5si3584952eda.215.2022.05.05.16.58.36; Thu, 05 May 2022 16:59:00 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=dqilBcIr; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354990AbiEDRHC (ORCPT + 99 others); Wed, 4 May 2022 13:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355260AbiEDQ7u (ORCPT ); Wed, 4 May 2022 12:59:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D30A049698; Wed, 4 May 2022 09:51:25 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E35ED617BD; Wed, 4 May 2022 16:51:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AD83C385A4; Wed, 4 May 2022 16:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683084; bh=IiuLVqn+41hK/TvtV51P7ny7tLaJWsoNCR7nCU1SY98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqilBcIrh6Kap5bYkcfvZm1bkSdbhoEm8ggD9b3cGqppUz3BxFidlGapi+V7uLLDu +wX54XPI3qbdNf9cgGSA0KatITTHySdz/zriAwG2nzlpH0CjwadRMNicsxNjRZawzy 5ZHCo6ku7MnHhQP2CXsMM7HBogbz78dB6HrH1t38= 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.10 075/129] cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe Date: Wed, 4 May 2022 18:44:27 +0200 Message-Id: <20220504153027.161534639@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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=-7.7 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,T_SCC_BODY_TEXT_LINE 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: 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