mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: supply: max77759: initialize registration, configurations
@ 2026-11-09 23:14 Christian Loehle
  2026-11-13 22:57 ` Amit Sunil Dhamne
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Loehle @ 2026-11-09 23:14 UTC (permalink / raw)
  To: amitsd, sre; +Cc: linux-pm, Greg Kroah-Hartman, linux-kernel

Booting a Pixel 6 with CONFIG_INIT_STACK_NONE can oops in
internal_create_group() while probing the MAX77759 charger. The probe
only initializes fwnode and drv_data in its automatic power_supply_config.
The power-supply core copies the uninitialized attr_grp into dev->groups,
allowing sysfs to follow an invalid attribute-group pointer.
The local regulator_config is also only partly initialized. Its unused
init_data, regmap and ena_gpiod fields can be consumed by regulator core.
Parsing the device tree does not initialize all of these fields.

Zero-initialize them both configurations before used fields are
assigned.

Fixes: 70d7dd27f6dc ("power: supply: max77759: add charger driver")
Cc: stable@vger.kernel.org
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
 drivers/power/supply/max77759_charger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
index a93adb266f01..e792327ff14f 100644
--- a/drivers/power/supply/max77759_charger.c
+++ b/drivers/power/supply/max77759_charger.c
@@ -683,8 +683,8 @@ static void max_tcpci_unregister_psy_notifier(void *nb)
 
 static int max77759_charger_probe(struct platform_device *pdev)
 {
-	struct regulator_config chgin_otg_reg_cfg;
-	struct power_supply_config psy_cfg;
+	struct regulator_config chgin_otg_reg_cfg = {};
+	struct power_supply_config psy_cfg = {};
 	struct device *dev = &pdev->dev;
 	struct max77759_charger *chg;
 	int ret;
-- 
2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: supply: max77759: initialize registration, configurations
  2026-11-09 23:14 [PATCH] power: supply: max77759: initialize registration, configurations Christian Loehle
@ 2026-11-13 22:57 ` Amit Sunil Dhamne
  0 siblings, 0 replies; 2+ messages in thread
From: Amit Sunil Dhamne @ 2026-11-13 22:57 UTC (permalink / raw)
  To: Christian Loehle, sre; +Cc: linux-pm, Greg Kroah-Hartman, linux-kernel

On 11/9/26 3:14 PM, Christian Loehle wrote:
> Booting a Pixel 6 with CONFIG_INIT_STACK_NONE can oops in
> internal_create_group() while probing the MAX77759 charger. The probe
> only initializes fwnode and drv_data in its automatic power_supply_config.
> The power-supply core copies the uninitialized attr_grp into dev->groups,
> allowing sysfs to follow an invalid attribute-group pointer.
> The local regulator_config is also only partly initialized. Its unused
> init_data, regmap and ena_gpiod fields can be consumed by regulator core.
> Parsing the device tree does not initialize all of these fields.
> 
> Zero-initialize them both configurations before used fields are
> assigned.
> 
> Fixes: 70d7dd27f6dc ("power: supply: max77759: add charger driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Amit Sunil Dhamne <amitsd@google.com>

> ---
>  drivers/power/supply/max77759_charger.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
> index a93adb266f01..e792327ff14f 100644
> --- a/drivers/power/supply/max77759_charger.c
> +++ b/drivers/power/supply/max77759_charger.c
> @@ -683,8 +683,8 @@ static void max_tcpci_unregister_psy_notifier(void *nb)
>  
>  static int max77759_charger_probe(struct platform_device *pdev)
>  {
> -	struct regulator_config chgin_otg_reg_cfg;
> -	struct power_supply_config psy_cfg;
> +	struct regulator_config chgin_otg_reg_cfg = {};
> +	struct power_supply_config psy_cfg = {};
>  	struct device *dev = &pdev->dev;
>  	struct max77759_charger *chg;
>  	int ret;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-13 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 23:14 [PATCH] power: supply: max77759: initialize registration, configurations Christian Loehle
2026-11-13 22:57 ` Amit Sunil Dhamne

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®