Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2536674lqp; Mon, 25 Mar 2024 01:35:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUi7B4euyALycg8RIAaBXuEmoG8HZttudlvReyvHUUWZHQz8sgN4Pp8Dobhz0c61bkLlhe4rIAH1uLmPrM7epSmDn2f1/jqxaCYiXU9XQ== X-Google-Smtp-Source: AGHT+IFZwCWZ2oZ+o4SCmc9T/6sB2bp/tybZXhvErFuXMTP0jtkBSoz19rbkR5dTVCeoUaw9u+w7 X-Received: by 2002:a17:906:fa9a:b0:a46:b809:4b22 with SMTP id lt26-20020a170906fa9a00b00a46b8094b22mr4072349ejb.45.1711355746146; Mon, 25 Mar 2024 01:35:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711355746; cv=pass; d=google.com; s=arc-20160816; b=Oxfca6XzzjnTJVdv02YM1WsquIZSEZg+tku8zijj9eYIcbADeM6b3YGD0qtSaE4cJ6 at+Edf5QYHD5TApREw6O++rKnA9mqiJj5ok4h3p9knb/vdw28modzf/fEaP1VCinCtRT 8D/p9m2kTlazM5SfXUtTCXsxTSzhG3I3PTSwdbg/7Qw+Ky7iEtZIS0x/OqG0eUIPxLoI WMtLQPvYXzZ4c4m0LC77vdfUwUrgSbbmRUc4a5rRXpl2XFe060iFYnL6kFk9h3hAndAh uG9n8nJWPfx8qGARfNTVofuPpB931R67r6jkqjtbQInCiAB1UsRyHLxKPP6B+CZeeWEE 2ilA== 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=EEGma7BJrA3cvrHNN42x+XO37fZTSEgI45o149rnJAE=; fh=OrVU2zlFMuozt0fdI5ldmAMJxs15Ik0L5X5DfqYio6Y=; b=BjVPPmJQDc1OTlnbNXqePQEPSQ5nihKF8uW7fCkMhSTA2EFQAWnA91GRVZYNvSQoxj v9EvIRJVpyFF0whpPdtL1h/or6JEV8xnfmGPEg4cBu+Bj1AYLtdUah7+GR96G5f9SJlL /BgU8A+I8Ap1+TNABbaNGOoUYBNNbRwnDZNJrEb6rm92N7z8jJk/o5JronX9Rv3nxeMm 4YflF9bpuSDWQkHBunSRLecH6tAnUoBMK5J5BOIZ1TTTlhnlj1zl/oxW7qKliq1tLao/ Qk7h6ziZBhYOZOKPIx1Z/fUPXlEfq/KadNopvawfYPvzLzL57wK+RJ3kXckRe2yuAZOm 2CLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eiUWnFJZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b3-20020a170906150300b00a473447791dsi2240153ejd.555.2024.03.25.01.35.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 01:35:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eiUWnFJZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116143-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116143-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8A2FF1F31855 for ; Mon, 25 Mar 2024 08:34:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4FF63B0A42; Mon, 25 Mar 2024 03:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eiUWnFJZ" 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 314A417A923; Sun, 24 Mar 2024 23:41:34 +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=1711323696; cv=none; b=i3RVOsc21rLHarrvcpH/pejRndGqeind4yh83jCk1bf9ZWB8yKszxDWjvm57NH5usP3YMxM4Z2r/28isuWLT2uPHqTO7YAtzzNPeyrT+KX6PYotwAmBU68NTCwrpi3Yv8wE9WXU/UmR85mg5GSoiPD8YnPcLMQe4pEKRca4y1n0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323696; c=relaxed/simple; bh=INN/gpk51sOf3ovPi5IuavhJHJQYrg/i54zt5o0DS0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fZvEObMjS00vtpAOT0U+ChubiAYkQ+MzeQUAECK5jx3rhb8jBLWL4u9I0OjjBRuQ36GRB0uAe2jPr7j19vKQmkIx37uxZu/tnfvrqRrgYApjZksCx7p4D751PMpe47v/FNS76dRs2kn/bWhSrZZrz8OwwCTAvFP1cgwC6uhg0wo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eiUWnFJZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F8DCC433F1; Sun, 24 Mar 2024 23:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323694; bh=INN/gpk51sOf3ovPi5IuavhJHJQYrg/i54zt5o0DS0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eiUWnFJZrXI/+zAjtXQZamNO/OR9fwuCjLEI2N4GN/Yo7Er/VmLRxmfyRifJ+IJgW 6TLz8L2ZbhHFdqTSD0/sHbfNSSu2ziVuFmjW8+GVu0gO4IDNh04fmVNB97KTzGSzEZ 6AmB3GrLrWr9TH2a3ZlUBrpj+7T4kxvo1QpoMGdPSkaebm2Zg6qHhuu8ZVECxdOZNh 2WJc0Jf+rw70rLnMtF8hfenevD0TeAZE6On/wTfeId5FpmG6CyNZo4KSdHNQJav+BV 35qqAkQFDzz7KUjILveRYaUCE0MbGQCM5N3YUn90yC3v6lWbXQS4KXiPtzD6x49Puo 6RFioxXAK/mEw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Armin Wolf , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH 5.10 067/238] ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit() Date: Sun, 24 Mar 2024 19:37:35 -0400 Message-ID: <20240324234027.1354210-68-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Armin Wolf [ Upstream commit e18afcb7b2a12b635ac10081f943fcf84ddacc51 ] After unregistering the CPU idle device, the memory associated with it is not freed, leading to a memory leak: unreferenced object 0xffff896282f6c000 (size 1024): comm "swapper/0", pid 1, jiffies 4294893170 hex dump (first 32 bytes): 00 00 00 00 0b 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 (crc 8836a742): [] kmalloc_trace+0x29d/0x340 [] acpi_processor_power_init+0xf3/0x1c0 [] __acpi_processor_start+0xd3/0xf0 [] acpi_processor_start+0x2c/0x50 [] really_probe+0xe2/0x480 [] __driver_probe_device+0x78/0x160 [] driver_probe_device+0x1f/0x90 [] __driver_attach+0xce/0x1c0 [] bus_for_each_dev+0x70/0xc0 [] bus_add_driver+0x112/0x210 [] driver_register+0x55/0x100 [] acpi_processor_driver_init+0x3b/0xc0 [] do_one_initcall+0x41/0x300 [] kernel_init_freeable+0x320/0x470 [] kernel_init+0x16/0x1b0 [] ret_from_fork+0x2d/0x50 Fix this by freeing the CPU idle device after unregistering it. Fixes: 3d339dcbb56d ("cpuidle / ACPI : move cpuidle_device field out of the acpi_processor_power structure") Signed-off-by: Armin Wolf Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/processor_idle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 59781e765e0e2..3deeabb273940 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1427,6 +1427,8 @@ int acpi_processor_power_exit(struct acpi_processor *pr) acpi_processor_registered--; if (acpi_processor_registered == 0) cpuidle_unregister_driver(&acpi_idle_driver); + + kfree(dev); } pr->flags.power_setup_done = 0; -- 2.43.0