lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQtoNxBstUI-c6qp@smile.fi.intel.com>
Date: Wed, 5 Nov 2025 17:07:35 +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:04:32PM +0200, Andy Shevchenko wrote:
> 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().

Ah, and if kvasprintf() fails, the error path will call irq_free_descs() and
then one more time in the release callback.

You finding is good, but the fix needs to be crafted thoughtfully.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ