Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2372189lqp; Sun, 24 Mar 2024 16:20:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAyRyFiFP04FMl5VH0h/SAM/vwb4grZzAFm5s5FlliClzCTN4W5kOnaJ2ZJBnXUbBKrWlr4A7+VAxxijmkub5RqB9zWLP3dXQewkr5Fg== X-Google-Smtp-Source: AGHT+IFV3YfrwcNPlg6SS3aHeGGXZXvV2PXGamnHEWnVFx4zSlektHf/TFpTfszIhxplnz71PYHg X-Received: by 2002:a25:2145:0:b0:dd9:2a67:f470 with SMTP id h66-20020a252145000000b00dd92a67f470mr3363262ybh.25.1711322454108; Sun, 24 Mar 2024 16:20:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711322454; cv=pass; d=google.com; s=arc-20160816; b=bUWwgMI91E2n3MnyV8DI/ibGLd/tROFd3/x9OS8loeA+i0ARVtmwRdJzxQ43GG0hBU eHVLT9WVb/c1tVGykacmUxtBzNwQP/zGjTnTNYERvG8AUOr5HLBwrZQrw9K51Omcb9xI uDMZST8JyiXqlEXAjO6AD1IwvxnNJy0BKIbITsLL3XjLnTZaLCOYt3qMa/4GlByiwWc8 2UZf/pfjSG7xnteLVBbrPBKGfbCcJ69Al0TXGJYlcYWuVEMdtp4WiM1ygkXsslibwoha UYN+VMIDGzSLqRKf8ZCK3dAeh5VjpXMw4qBrvj9hITPVvUML/0I9WIcVexJNhD9PlEcc L+hQ== 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=El7fduqFbbtAdNwtrtR/d8rL2m3QXWwxxtNRKI1s2JY=; fh=OrVU2zlFMuozt0fdI5ldmAMJxs15Ik0L5X5DfqYio6Y=; b=rPRhhEyuFW7q8wwWlqqNeXmEOyS/USXZ/T7Eawh9UTbpy8lY9hBaoGqTtRGrO76hZ8 Z9quWppRvA6vRAPjubo5Gsa4+bF8F2djD0mHzsV6dMNORBd+kxY6Mae9ror0slOxdRBU A/JDtobJS5AlFq+O42YzGo4TuAuI1v6PepGQG1YnDsUyb2T60IBVUD2p2/ATrswwNWYg +egtANjUX6jnlC3dfCmgwHghZODo29u+PNaV82SIlCec+b8Na0UL2xllhbFYWBiNfzw+ a8NWFMevnpJybtdLUjbGinadVK25HGY/RmsnpyzA70Bc19umsSW/UbF3bxuEbD7lRzLa 8tZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VKt+9sJz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pt19-20020a056214049300b00695d4a4fbfasi6714499qvb.53.2024.03.24.16.20.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VKt+9sJz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113096-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AB5301C21909 for ; Sun, 24 Mar 2024 23:20:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F13F15445F; Sun, 24 Mar 2024 22:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VKt+9sJz" 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 2CAE3154443; Sun, 24 Mar 2024 22:38:24 +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=1711319904; cv=none; b=FXaMV7bbUhjOe5Kx6/VkdxRINPiGZQwUHW03hXJfholLy/xMVjtpPcsbDakeeEMgOXrNnXl4vXGDlfaHkZswA9I/wZhaxkdmu5N+iCOrIZVWma7sXuXREuK2oy8fTEwqGOhpHSexLLFA8kBk+B2nnWrCpdY8MvOq3aHbWP6h57M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319904; c=relaxed/simple; bh=nfu/1bifCRzhzUwuYeSYF4B5jVHi/FobrLmXrxCk7CI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bXcQlipyuAJbc6nF6yapuZXDRmfCLj0J40pXvz3nbA2wpep+mK4wCgwKjrHqQ+XXMjhaFU4K85xIV9ufMQ/lhxXL8nptrp+WI+GoNKRQe94iGcrWrGT54psizjFyvMWl54nESczwh1EI94cUya0VhxNtbPEs7rc9/OVyaU8e4JM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VKt+9sJz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B7B2C43399; Sun, 24 Mar 2024 22:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319904; bh=nfu/1bifCRzhzUwuYeSYF4B5jVHi/FobrLmXrxCk7CI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKt+9sJznh2vJlxnrKeRSOAvscqzLh6S2BwjB8OKd3jChQKPoF+EVte6xibKHWl2I S1emPnVf+RZFyafUjzFGTYMb3VyqL+06Cu1cS+6zvfE5U6Hk7IIHbwZ/cKS1pl4rbP V1AVb/GheVe9EklDrStwi9zVSUdbD7X5KvhAJj7dYRoiNWGSla3FZcRelaacTinQWW Rv2i/tz/BHvhkDwve52OI9oBZW6Lj9rYB8mRKjiJJt1JPsJ0YikWavc515TVl5CX1p TAzv+cxZpL6lJY2liKFgtX8sUGrP8K8gNqA7ORdJ157gAgNQXvL52EjUH6Wvr4VNvX 2RnhtjX/P9QOw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Armin Wolf , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH 6.8 209/715] ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit() Date: Sun, 24 Mar 2024 18:26:28 -0400 Message-ID: <20240324223455.1342824-210-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 55437f5e0c3ae..bd6a7857ce058 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1430,6 +1430,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