public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Kenneth Chan <kenneth.t.chan@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	Azael Avalos <coproscefalo@gmail.com>,
	Matthew Garrett <matthew.garrett@nebula.com>
Subject: [PATCH v1 1/2] platform/x86: panasonic-laptop: Fix sysfs group leak in error path
Date: Tue, 20 Jan 2026 16:43:44 +0100	[thread overview]
Message-ID: <3398370.44csPzL39Z@rafael.j.wysocki> (raw)
In-Reply-To: <3026924.e9J7NaK4W3@rafael.j.wysocki>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The acpi_pcc_hotkey_add() error path leaks sysfs group pcc_attr_group
if platform_device_register_simple() fails for the "panasonic" platform
device.

Address this by making it call sysfs_remove_group() in that case for
the group in question.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/panasonic-laptop.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -1089,7 +1089,7 @@ static int acpi_pcc_hotkey_add(struct ac
 			PLATFORM_DEVID_NONE, NULL, 0);
 		if (IS_ERR(pcc->platform)) {
 			result = PTR_ERR(pcc->platform);
-			goto out_backlight;
+			goto out_sysfs;
 		}
 		result = device_create_file(&pcc->platform->dev,
 			&dev_attr_cdpower);
@@ -1105,6 +1105,8 @@ static int acpi_pcc_hotkey_add(struct ac
 
 out_platform:
 	platform_device_unregister(pcc->platform);
+out_sysfs:
+	sysfs_remove_group(&device->dev.kobj, &pcc_attr_group);
 out_backlight:
 	backlight_device_unregister(pcc->backlight);
 out_input:




  reply	other threads:[~2026-01-20 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 15:42 [PATCH v1 0/2] platform/x86: Fixes for leaks in panasonic-laptop and toshiba-haps drivers Rafael J. Wysocki
2026-01-20 15:43 ` Rafael J. Wysocki [this message]
2026-01-20 15:44 ` [PATCH v1 2/2] platform/x86: toshiba_haps: Fix memory leaks in add/remove routines Rafael J. Wysocki
2026-01-21 10:57   ` [PATCH v2 " Rafael J. Wysocki
2026-01-26 14:56 ` [PATCH v1 0/2] platform/x86: Fixes for leaks in panasonic-laptop and toshiba-haps drivers Ilpo Järvinen
2026-01-26 19:00   ` Rafael J. Wysocki
2026-01-27 11:04     ` Ilpo Järvinen
2026-01-27 13:36       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3398370.44csPzL39Z@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=coproscefalo@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kenneth.t.chan@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox