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: <3438e843e2304e22456b4ea83796f1118564b3f4.camel@analog.com>
Date:   Fri, 20 Sep 2019 06:46:05 +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 v2] iio: imu: adis16400: fix memory leak

On Thu, 2019-09-19 at 10:56 -0500, Navid Emamdoost wrote:
> In adis_update_scan_mode_burst, if adis->buffer allocation fails release
> the adis->xfer.
> 
> v2: set adis->xfer = NULL to avoid any potential double free.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@...log.com>

> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
>  drivers/iio/imu/adis_buffer.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/adis_buffer.c
> b/drivers/iio/imu/adis_buffer.c
> index 9ac8356d9a95..78fe83c1f4fe 100644
> --- a/drivers/iio/imu/adis_buffer.c
> +++ b/drivers/iio/imu/adis_buffer.c
> @@ -35,8 +35,11 @@ static int adis_update_scan_mode_burst(struct iio_dev
> *indio_dev,
>  		return -ENOMEM;
>  
>  	adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL);
> -	if (!adis->buffer)
> +	if (!adis->buffer) {
> +		kfree(adis->xfer);
> +		adis->xfer = NULL;
>  		return -ENOMEM;
> +	}
>  
>  	tx = adis->buffer + burst_length;
>  	tx[0] = ADIS_READ_REG(adis->burst->reg_cmd);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ