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: <20180415201755.62a73e7d@archlinux>
Date:   Sun, 15 Apr 2018 20:17:55 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
        nfarnesi4@...il.com, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2 1/2] iio: sca3000: Fix an error handling path in
 'sca3000_probe()'

On Sun,  8 Apr 2018 21:44:01 +0200
Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote:

> Use 'devm_iio_kfifo_allocate()' instead of 'iio_kfifo_allocate()' in order
> to simplify code and avoid a memory leak in an error path in
> 'sca3000_probe()'. A call to 'sca3000_unconfigure_ring()' was missing.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

I thought about queueing this up as a fix, but as it is unlikely
to be hit and there is another patch (which isn't a fix) dependent
on it I went with the worst of both worlds and took it for the next
merge window whilst marking it for stable.

I added a note to the description to say why for when people see
it next cycle

Thanks,

Jonathan

> ---
> v2: Use a devm_ function to fix the leak reported in v1.
>     This makes 'sca3000_unconfigure_ring()' useless and simplify code.
> ---
>  drivers/iio/accel/sca3000.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
> index f33dadf7b262..562f125235db 100644
> --- a/drivers/iio/accel/sca3000.c
> +++ b/drivers/iio/accel/sca3000.c
> @@ -1277,7 +1277,7 @@ static int sca3000_configure_ring(struct iio_dev *indio_dev)
>  {
>  	struct iio_buffer *buffer;
>  
> -	buffer = iio_kfifo_allocate();
> +	buffer = devm_iio_kfifo_allocate(&indio_dev->dev);
>  	if (!buffer)
>  		return -ENOMEM;
>  
> @@ -1287,11 +1287,6 @@ static int sca3000_configure_ring(struct iio_dev *indio_dev)
>  	return 0;
>  }
>  
> -static void sca3000_unconfigure_ring(struct iio_dev *indio_dev)
> -{
> -	iio_kfifo_free(indio_dev->buffer);
> -}
> -
>  static inline
>  int __sca3000_hw_ring_state_set(struct iio_dev *indio_dev, bool state)
>  {
> @@ -1546,8 +1541,6 @@ static int sca3000_remove(struct spi_device *spi)
>  	if (spi->irq)
>  		free_irq(spi->irq, indio_dev);
>  
> -	sca3000_unconfigure_ring(indio_dev);
> -
>  	return 0;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ