Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2562728lqp; Mon, 25 Mar 2024 02:41:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgObJinlMZz2r9ScsHf2KRp0hrbMwLaMUC1C1Rwi+miUeRbKznUDTXHI6ERwEM5LZGuCgULw6eNroNU2MEMNDh805mYes4rG1s5x8XlA== X-Google-Smtp-Source: AGHT+IHhaCjNe1aJzUCtrbTVooKY4Z8RKgRu0ZrWzWcQVjSKN20KLF2TxTdMyALgeHTPdsAM+ZOs X-Received: by 2002:a05:6808:128f:b0:3c3:a294:5bc9 with SMTP id a15-20020a056808128f00b003c3a2945bc9mr9864390oiw.9.1711359705316; Mon, 25 Mar 2024 02:41:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711359705; cv=pass; d=google.com; s=arc-20160816; b=WBrWt00hSNbBzo0NbatWD8BFXQAchzss3EVY1sPBstGZcZjnuqB42TKKsvxT26YLQA tNbEUzwLtBbWi/JKaT0l1plwmmGDeyNnplCwyuoU3Jz7Q6kmfYbBcYoBuW9Z4Lj1Z4YO 8nPDY+Cm+GX/5CSSrJgSWn62Mf8xmBERYsYibEOJ7GWiXakVoabUgk1GXpeGI6iyApIu zFsAbRbuBfFKojUzF0ZlXiEsNDNnaTz7LNAPqwEl/N3m/ynHXoQGk71ctSvKUudGqt4H 44UNcTVHXUa4NiiaKe9majLS5TEc863B60ejsND+boynvWtcgbTN07VythPwjz6J2kOC rxWQ== 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=3dJ1wLSz8os5dXBf4mDbuWmqwn8rZqBiu1v4I+2sImw=; fh=OrVU2zlFMuozt0fdI5ldmAMJxs15Ik0L5X5DfqYio6Y=; b=ynkTMr1tkdAaiG8vrWw3nsNX+Hcm0q0JsJKI/kG83iLyCygF5Ja6l2nZOPCUY1dzaX 47A9/NsztrCrxfb8nUPEBErMQJl00/VO9LKVkEAAwA/7AbQIO0gp3fUxwJTcIUc7ujSb 3iTh1qxzpqNGga6wnevAXvM45hAhhsUij1p/bJByuChm6nhFLjCZvDSnFp7oLM3dMOn2 9Sex+I3KdGZejGi6qZtZwJTO5bQii8D9aiDKQewsLP800ULyKF+LUNCgWyKK28PrqjzO PuJQrMUjmHzp5PadxSdX/9shNOqFcWxWqcNiFyCTkmhDv8rfjLwcDb50id5u+k22Wdw/ DZow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PsP/89b9"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115887-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115887-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fi31-20020a056a00399f00b006ea6ca5292fsi5076868pfb.173.2024.03.25.02.41.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:41:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115887-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PsP/89b9"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115887-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115887-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0248829DFBE for ; Mon, 25 Mar 2024 09:41:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9275838485C; Mon, 25 Mar 2024 03:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PsP/89b9" 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 0F86F1474A4; Sun, 24 Mar 2024 23:14:40 +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=1711322080; cv=none; b=hETL+11fSSPBuN12jQ1Bv+QN/2zQcfUVonSBCL5NXHbWcJ7I4W+Semn8QdapZRdCZsOya+UcZiwQlkrqSJMoUu6nxv+zyOuIBbXEi0LXn7xBvwHCRBKgpkdk/dtkXz20E4wzlfb0/8LQ6nSYI5bA3/OhGZ/ty9BxWok74QGZ1LM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322080; c=relaxed/simple; bh=qzn366CElNlg9m2P1/pV3tCS4YAo8KKGyN8lBwYTbPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qvgB3vj4MHtyGspkPzpoIQkGvVMGePN/vnyl2/ns7Og/qbUwcUGplltoDMyyo3ci4vMl6IM+8Ha82GeXg6Ff2BbrCBsmwO3Aw8ywDjtrNyxET5UbFeibQomXPMN4yVD9p2JUqUX4yHDjYMm40W0qH/5qsmBmADbEUSa+PeEuyzA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PsP/89b9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BFC1C433F1; Sun, 24 Mar 2024 23:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322079; bh=qzn366CElNlg9m2P1/pV3tCS4YAo8KKGyN8lBwYTbPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsP/89b9Ask0qPd3Yo4bt6jzyx6jaMy20ydZXfOog446Cl5UPLZ6ZM3oIflqcwZb6 vqrW8xGKFTWY4Vh0aVt+wIjQNpZuNNpSEIql0JF92/1cDaAHYXqxr0REqrpM7ElgnW MJ+qorjEJwQfVbm4e92n7EMxTd7k4yU53/SYU5zB1bdT6uVg0TBU/dnM87Kx4bPGJH URDs6A9sw9z4Wig945W6PUoBpWy5XDdBj4jVl5oISa4zoETLRwxYLeky5bxJaTwqIy fuZyctxGNyalHLBAaQLlDFvPKJrgLPhBvm4NOSy6cksffnZDjYyggHTrJUBlisyE5a 90FIejmpAeMbQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Armin Wolf , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH 6.1 153/451] ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit() Date: Sun, 24 Mar 2024 19:07:09 -0400 Message-ID: <20240324231207.1351418-154-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 fc5b5b2c9e819..6f613eef28879 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1431,6 +1431,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