Skip to content

Draft: iio: core: fix memleak in iio_device_register_sysfs

Prarit Bhargava requested to merge prarit/centos-stream-9:RHEL-33153-test into main

JIRA: https://issues.redhat.com/browse/RHEL-33153
CVE: CVE-2023-52643

commit 95a0d596bbd0552a78e13ced43f2be1038883c81
Author: Dinghao Liu dinghao.liu@zju.edu.cn
Date: Fri Dec 8 15:31:19 2023 +0800

iio: core: fix memleak in iio_device_register_sysfs  

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@zju.edu.cn>  
Link: https://lore.kernel.org/r/20231208073119.29283-1-dinghao.liu@zju.edu.cn  
Cc: <Stable@vger.kernel.org>  
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  

Signed-off-by: Prarit Bhargava prarit@redhat.com

Merge request reports