Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux@analog.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] iio: adc: ade9000: fix NULL pointer dereference in clkout registration
Date: Wed, 26 Aug 2026 10:23:13 +0300	[thread overview]
Message-ID: <ao6UYYBFrpxJmY27@ashevche-desk.local> (raw)
In-Reply-To: <d8d17463-cde2-47a0-9e18-ffa5d8cab52b@kylinos.cn>

On Wed, Aug 26, 2026 at 10:24:18AM +0800, Linmao Li wrote:
> 
> 在 2026/8/24 23:08, Andy Shevchenko 写道:
> > On Mon, Aug 24, 2026 at 08:52:10PM +0800, Linmao Li wrote:
> > > ade9000_setup_clkout() passes NULL as the register address when
> > > registering a divider clock. During clock registration, the common
> > > clock framework calls clk_divider_recalc_rate(), which dereferences
> > > the address through readl(). As a result, probing an ADE9000 configured
> > > as a clock provider with an external input clock crashes.
> > > 
> > > CLKOUT passes CLKIN through without changing its rate. Register it as
> > > a 1:1 fixed-factor clock, which does not require register access.
> > Do you have HW to test? What will be the result for the internal clock case?
> No, unfortunately I do not have access to the hardware, so this is
> based on code inspection only.
> 
> For the crystal oscillator case, the device tree does not provide a
> clocks property. devm_clk_get_optional_enabled() therefore returns
> NULL, and ade9000_setup_clkout() returns here:
> 
>         if (!device_property_present(dev, "#clock-cells") || !st->clkin)
>                 return 0;
> 
> No clock provider is registered in that case. This behavior is
> unchanged by the patch. The modified registration path is reached only
> when an external input clock is present and the device is configured as
> a clock provider.

Then add a sentence to summarise this, something like "this change doesn't
affect the configuration with the internal clock".

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-08-26  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 12:52 [PATCH] iio: adc: ade9000: fix NULL pointer dereference in clkout registration Linmao Li
2026-08-24 15:08 ` Andy Shevchenko
2026-08-26  2:24   ` Linmao Li
2026-08-26  7:23     ` 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=ao6UYYBFrpxJmY27@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lilinmao@kylinos.cn \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox