mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Salah Triki" <salah.triki@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: trigger: use put_device() in viio_trigger_alloc() error path
Date: Wed, 18 Feb 2026 09:14:57 +0000	[thread overview]
Message-ID: <f8292da100b987808c943821b48690002345724a.camel@gmail.com> (raw)
In-Reply-To: <aZSEVpQBgHlRHbeW@smile.fi.intel.com>

On Tue, 2026-02-17 at 17:08 +0200, Andy Shevchenko wrote:
> On Tue, Feb 17, 2026 at 01:51:08PM +0000, Nuno Sá wrote:
> > On Mon, 2026-02-16 at 09:45 +0100, Salah Triki wrote:
> > > 
> > > You are absolutely right. My previous version (v3) was logically flawed as
> > > it could trigger the release callback before the necessary fields were
> > > initialized, leading to an unsafe irq_free_descs() call.
> > > 
> > > Since I don't have the physical hardware to perform runtime injection
> > > tests,I relied on manual code path analysis and clearly failed to account
> > > for the side effects of put_device().
> > > 
> > > I'm sending a v4 which takes the safer approach: moving
> > > device_initialize() after all potential failure points. This way, we can
> > > safely use kfree() and irq_free_descs() in the error path without
> > > involving the device lifecycle prematurely.
> > > 
> > > Thank you for the catch.
> > 
> > Please just use the same approach Andy did for iio_device_alloc(). I posted
> > links (in one of your versions) to that and for the discussion we already had
> > on this same function some time ago.
> 
> I believe this is the approach mentioned above, id est move device_initialize()
> further in the code. But I might misread something...

Me too. But if that was the case, I would not expect any put_device() call. Ah, but I just read
Salah's reply. It will be done in v4.

- Nuno Sá

      reply	other threads:[~2026-02-18  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-15 22:23 Salah Triki
2026-02-16  7:55 ` Andy Shevchenko
2026-02-16  8:45   ` Salah Triki
2026-02-17 13:51     ` Nuno Sá
2026-02-17 15:08       ` Andy Shevchenko
2026-02-18  9:14         ` Nuno Sá [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=f8292da100b987808c943821b48690002345724a.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=salah.triki@gmail.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®