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]
Message-ID: <84e2832b52cc88665ff071942c1545b83eeb5602.camel@analog.com>
Date:   Thu, 19 Sep 2019 06:51:40 +0000
From:   "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To:     "navid.emamdoost@...il.com" <navid.emamdoost@...il.com>
CC:     "Popa, Stefan Serban" <StefanSerban.Popa@...log.com>,
        "emamd001@....edu" <emamd001@....edu>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "jic23@...nel.org" <jic23@...nel.org>,
        "knaack.h@....de" <knaack.h@....de>,
        "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "smccaman@....edu" <smccaman@....edu>,
        "kjlu@....edu" <kjlu@....edu>,
        "pmeerw@...erw.net" <pmeerw@...erw.net>
Subject: Re: [PATCH] iio: imu: adis16400: release allocated memory on failure

On Wed, 2019-09-18 at 11:57 -0500, Navid Emamdoost wrote:
> [External]
> 

Hey,

Good catch.
One comment inline.

> In adis_update_scan_mode, if allocation for adis->buffer fails,
> previously allocated adis->xfer needs to be released.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
>  drivers/iio/imu/adis_buffer.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/adis_buffer.c
> b/drivers/iio/imu/adis_buffer.c
> index 9ac8356d9a95..c5d7e368a636 100644
> --- a/drivers/iio/imu/adis_buffer.c
> +++ b/drivers/iio/imu/adis_buffer.c
> @@ -78,8 +78,10 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
>  		return -ENOMEM;
>  
>  	adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL);
> -	if (!adis->buffer)
> +	if (!adis->buffer) {
> +		kfree(adis->xfer);

Maybe also do  "adis->xfer = NULL" here.
The idea is to make sure that the pointer is not double-free'd by some
other function (i.e. adis_cleanup_buffer_and_trigger() or another
adis_update_scan_mode() call).

>  		return -ENOMEM;
> +	}
>  
>  	rx = adis->buffer;
>  	tx = rx + scan_count;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ