From: Hans de Goede <hansg@kernel.org>
To: Qiu Wenbo <qiuwenbo@gnome.org>, Daniel Scally <djrscally@gmail.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] platform/x86: int3472: Fix double free of GPIO device during unregister
Date: Tue, 28 Oct 2025 10:34:47 +0100 [thread overview]
Message-ID: <37667f90-7333-4316-8858-8445f8f81409@kernel.org> (raw)
In-Reply-To: <20251028063009.289414-1-qiuwenbo@gnome.org>
Hi,
On 28-Oct-25 7:30 AM, Qiu Wenbo wrote:
> From: Qiu Wenbo <qiuwenbo@kylinsec.com.cn>
>
> regulator_unregister() already frees the associated GPIO device. On
> ThinkPad X9 (Lunar Lake), this causes a double free issue that leads to
> random failures when other drivers (typically Intel THC) attempt to
> allocate interrupts. The root cause is that the reference count of the
> pinctrl_intel_platform module unexpectedly drops to zero when this
> driver defers its probe.
>
> This behavior can also be reproduced by unloading the module directly.
>
> Fix the issue by removing the redundant release of the GPIO device
> during regulator unregistration.
>
> Cc: stable@vger.kernel.org
> Fixes: 1e5d088a52c2 ("platform/x86: int3472: Stop using devm_gpiod_get()")
> Signed-off-by: Qiu Wenbo <qiuwenbo@kylinsec.com.cn>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hansg@kernel.org>
Regards,
Hans
> ---
> Changes since V1:
> - Add Reviewed-by: from Andy Shevchenko and Sakari Ailus
> - Add Cc to stable@
> - Remove the blank line after Fixes:
>
> drivers/platform/x86/intel/int3472/clk_and_regulator.c | 5 +----
> include/linux/platform_data/x86/int3472.h | 1 -
> 2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> index 476ec24d37020..9e052b164a1ab 100644
> --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> @@ -245,15 +245,12 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
> if (IS_ERR(regulator->rdev))
> return PTR_ERR(regulator->rdev);
>
> - int3472->regulators[int3472->n_regulator_gpios].ena_gpio = gpio;
> int3472->n_regulator_gpios++;
> return 0;
> }
>
> void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472)
> {
> - for (int i = 0; i < int3472->n_regulator_gpios; i++) {
> + for (int i = 0; i < int3472->n_regulator_gpios; i++)
> regulator_unregister(int3472->regulators[i].rdev);
> - gpiod_put(int3472->regulators[i].ena_gpio);
> - }
> }
> diff --git a/include/linux/platform_data/x86/int3472.h b/include/linux/platform_data/x86/int3472.h
> index 1571e9157fa50..b1b837583d544 100644
> --- a/include/linux/platform_data/x86/int3472.h
> +++ b/include/linux/platform_data/x86/int3472.h
> @@ -100,7 +100,6 @@ struct int3472_gpio_regulator {
> struct regulator_consumer_supply supply_map[GPIO_REGULATOR_SUPPLY_MAP_COUNT * 2];
> char supply_name_upper[GPIO_SUPPLY_NAME_LENGTH];
> char regulator_name[GPIO_REGULATOR_NAME_LENGTH];
> - struct gpio_desc *ena_gpio;
> struct regulator_dev *rdev;
> struct regulator_desc rdesc;
> };
next prev parent reply other threads:[~2025-10-28 9:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 5:05 [PATCH] " Qiu Wenbo
2025-10-24 6:15 ` Andy Shevchenko
2025-10-24 7:25 ` Sakari Ailus
2025-10-28 6:30 ` [PATCH v2] " Qiu Wenbo
2025-10-28 9:34 ` Hans de Goede [this message]
2025-10-28 16:37 ` Ilpo Järvinen
2025-10-28 8:55 ` [PATCH] " Dan Scally
2025-10-28 10:02 ` Andy Shevchenko
2025-10-28 10:38 ` Hans de Goede
2025-10-28 10:54 ` Andy Shevchenko
2025-10-28 11:09 ` Dan Scally
2025-10-28 11:38 ` Andy Shevchenko
2025-10-28 14:36 ` Hans de Goede
2025-10-28 14:47 ` Andy Shevchenko
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=37667f90-7333-4316-8858-8445f8f81409@kernel.org \
--to=hansg@kernel.org \
--cc=andy@kernel.org \
--cc=djrscally@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qiuwenbo@gnome.org \
--cc=sakari.ailus@linux.intel.com \
/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
all inboxes | Powered by JetHome®