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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Oct 2021 10:43:23 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Alexandru Ardelean <ardeleanalex@...il.com>
Cc:     Yang Yingliang <yangyingliang@...wei.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH] iio: buffer: Fix double-free in
 iio_buffers_alloc_sysfs_and_mask()

On Tue, 2021-10-12 at 23:30 +0300, Andy Shevchenko wrote:
> On Tue, Oct 12, 2021 at 2:37 PM Alexandru Ardelean
> <ardeleanalex@...il.com> wrote:
> > 
> > On Tue, Oct 12, 2021 at 12:18 PM Yang Yingliang
> > <yangyingliang@...wei.com> wrote:
> > > 
> > > When __iio_buffer_alloc_sysfs_and_mask() failed, 'unwind_idx' should be
> > > set to 'i - 1' to prevent double-free when cleanup resources.
[]
> 
> I prefer to see
> 
> - for (; unwind_idx >= 0; unwind_idx--) {
> + while (unwind_idx--)

Not the same code as unwind_idx would be decremented before entering
the code block.

You'd want

	do {
		...
	} while (unwind_idx--);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ