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: <20231210133228.5fd425ea@jic23-huawei>
Date:   Sun, 10 Dec 2023 13:32:28 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Dinghao Liu <dinghao.liu@....edu.cn>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: core: fix memleak in iio_device_register_sysfs

On Fri,  8 Dec 2023 15:31:19 +0800
Dinghao Liu <dinghao.liu@....edu.cn> wrote:

> When iio_device_register_sysfs_group() fails, we should
> free iio_dev_opaque->chan_attr_group.attrs to prevent
> potential memleak.
> 
> Fixes: 32f171724e5c ("iio: core: rework iio device group creation")
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
Hi.

Looks good to me, but I'd like to leave this one on the list a little
longer to see if anyone else has comments.

Jonathan

> ---
>  drivers/iio/industrialio-core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index c77745b594bd..e6d3d07a4c83 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1581,10 +1581,13 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)
>  	ret = iio_device_register_sysfs_group(indio_dev,
>  					      &iio_dev_opaque->chan_attr_group);
>  	if (ret)
> -		goto error_clear_attrs;
> +		goto error_free_chan_attrs;
>  
>  	return 0;
>  
> +error_free_chan_attrs:
> +	kfree(iio_dev_opaque->chan_attr_group.attrs);
> +	iio_dev_opaque->chan_attr_group.attrs = NULL;
>  error_clear_attrs:
>  	iio_free_chan_devattr_list(&iio_dev_opaque->channel_attr_list);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ