[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQtnfzUKHc0fY52_@smile.fi.intel.com>
Date: Wed, 5 Nov 2025 17:04:31 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Ma Ke <make24@...as.ac.cn>
Cc: jic23@...nel.org, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org, error27@...il.com, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
stable@...r.kernel.org
Subject: Re: [PATCH] iio: trigger: Fix error handling in viio_trigger_alloc
On Wed, Nov 05, 2025 at 05:47:14PM +0800, Ma Ke wrote:
> viio_trigger_alloc() initializes the device with device_initialize()
> but uses kfree() directly in error paths, which bypasses the device's
> release callback iio_trig_release(). This could lead to memory leaks
> and inconsistent device state.
>
> Replace kfree(trig) with put_device(&trig->dev) in error paths to
> ensure proper cleanup through the device's release callback.
Now when irq_alloc_descs() fails, trig->subirq_base becomes negative and
in the release callback it will pass the
if (trig->subirq_base) {
Is it a problem?
The release function also misses mutex_destroy().
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists