All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: maudspierings@gocontroll.com
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Christian Heusel" <christian@heusel.eu>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: common: st_sensors: Fix use of uninitialize device structs
Date: Fri, 23 May 2025 19:45:10 +0300	[thread overview]
Message-ID: <aDCmFm5fso98w3AV@smile.fi.intel.com> (raw)
In-Reply-To: <20250522-st_iio_fix-v2-1-07a32655a996@gocontroll.com>

On Thu, May 22, 2025 at 01:18:55PM +0200, Maud Spierings via B4 Relay wrote:
> 
> Throughout the various probe functions &indio_dev->dev is used before it
> is initialized. This caused a kernel panic in st_sensors_power_enable

st_sensors_power_enable()

> when the call to devm_regulator_bulk_get_enable() fails and then calls
> dev_err_probe() with the uninitialized device.
> 
> This seems to only cause a panic with dev_err_probe(), dev_err,

dev_err()

> dev_warn and dev_info don't seem to cause a panic, but are fixed

dev_warn()
dev_info()

> as well.

> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
> ---
> When I search for general &indio_dev->dev usage, I see quite a lot more
> hits, but I am not sure if there are issues with those too.
> 
> This issue has existed for a long time it seems and therefore it is
> nearly impossible to find a proper fixes tag. I would love to see it at
> least backported to 6.12 as that is where I encountered it, and I
> believe the patch should apply without conflicts.

> The investigation into this issue can be found in this thread [1]
> 
> [1]: https://lore.kernel.org/all/AM7P189MB100986A83D2F28AF3FFAF976E39EA@AM7P189MB1009.EURP189.PROD.OUTLOOK.COM/

Shouldn't it be moved to the commit message as Link tag?

...

> -		return dev_err_probe(&indio_dev->dev, err,
> +		return dev_err_probe(parent, err,
>  				     "unable to enable supplies\n");

Now it can be put on one line (yes, only 1 or 2 characters longer than 80).

...

> -		dev_info(&indio_dev->dev,
> +		dev_info(parent,
>  			 "interrupts on the rising edge\n");

Ditto.

...

> -		dev_info(&indio_dev->dev,
> +		dev_info(parent,
>  			 "interrupts active high level\n");

Ditto.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2025-05-23 16:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 11:18 [PATCH v2] iio: common: st_sensors: Fix use of uninitialize device structs Maud Spierings
2025-05-22 11:18 ` Maud Spierings via B4 Relay
2025-05-22 11:20 ` kernel test robot
2025-05-22 17:12 ` Jonathan Cameron
2025-05-23  6:36   ` Maud Spierings
2025-05-23 16:46   ` Andy Shevchenko
2025-05-23 16:45 ` Andy Shevchenko [this message]

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=aDCmFm5fso98w3AV@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=christian@heusel.eu \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maudspierings@gocontroll.com \
    --cc=nuno.sa@analog.com \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.