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]
Date:   Fri, 29 May 2020 07:50:13 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Cc:     linux-pm@...r.kernel.org, linux-acpi@...r.kernel.org,
        netdev@...r.kernel.org, linux-wireless@...r.kernel.org,
        platform-driver-x86@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-renesas-soc@...r.kernel.org,
        linux-rockchip@...ts.infradead.org,
        Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
        Heiko Stuebner <heiko@...ech.de>,
        "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Vishal Kulkarni <vishal@...lsio.com>,
        Luca Coelho <luciano.coelho@...el.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        kernel@...labora.com, Fabio Estevam <festevam@...il.com>,
        Amit Kucheria <amit.kucheria@...durent.com>,
        Chunyan Zhang <zhang.lyra@...il.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Allison Randal <allison@...utok.net>,
        NXP Linux Team <linux-imx@....com>,
        Darren Hart <dvhart@...radead.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Gayatri Kammela <gayatri.kammela@...el.com>,
        Len Brown <lenb@...nel.org>,
        Johannes Berg <johannes.berg@...el.com>,
        Intel Linux Wireless <linuxwifi@...el.com>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Ido Schimmel <idosch@...lanox.com>,
        Baolin Wang <baolin.wang7@...il.com>,
        Jiri Pirko <jiri@...lanox.com>,
        Orson Zhai <orsonzhai@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Kalle Valo <kvalo@...eaurora.org>,
        Support Opensource <support.opensource@...semi.com>,
        Enrico Weigelt <info@...ux.net>,
        Peter Kaestle <peter@...e.net>,
        Sebastian Reichel <sre@...nel.org>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Niklas Söderlund 
        <niklas.soderlund@...natech.se>, Shawn Guo <shawnguo@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Andy Shevchenko <andy@...radead.org>
Subject: Re: [PATCH v4 01/11] acpi: thermal: Fix error handling in the
 register function

On Thu, May 28, 2020 at 09:20:41PM +0200, Andrzej Pietrasiewicz wrote:
> The acpi_thermal_register_thermal_zone() is missing any error handling.
> This needs to be fixed.
> 
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
>  drivers/acpi/thermal.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 19067a5e5293..6de8066ca1e7 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -901,23 +901,35 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
>  	result = sysfs_create_link(&tz->device->dev.kobj,
>  				   &tz->thermal_zone->device.kobj, "thermal_zone");
>  	if (result)
> -		return result;
> +		goto unregister_tzd;
>  
>  	result = sysfs_create_link(&tz->thermal_zone->device.kobj,
>  				   &tz->device->dev.kobj, "device");
>  	if (result)
> -		return result;
> +		goto remove_tz_link;
>  
>  	status =  acpi_bus_attach_private_data(tz->device->handle,
>  					       tz->thermal_zone);
> -	if (ACPI_FAILURE(status))
> -		return -ENODEV;
> +	if (ACPI_FAILURE(status)) {
> +		result = -ENODEV;
> +		goto remove_dev_link;
> +	}
>  
>  	tz->tz_enabled = 1;
>  
>  	dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
>  		 tz->thermal_zone->id);
> +
>  	return 0;
> +
> +remove_dev_link:
> +	sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
> +remove_tz_link:
> +	sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
> +unregister_tzd:
> +	thermal_zone_device_unregister(tz->thermal_zone);
> +
> +	return result;
>  }
>  
>  static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ