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:	Wed, 24 Aug 2011 17:36:11 +0200
From:	Borislav Petkov <bp@...64.org>
To:	Julia Lawall <julia@...u.dk>
CC:	Tigran Aivazian <tigran@...azian.fsnet.co.uk>,
	<kernel-janitors@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, <x86@...nel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arch/x86/kernel/microcode_core.c: add missing
 platform_device_unregister

On Wed, Aug 24, 2011 at 05:10:52PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@...u.dk>
> 
> Call platform_device_unregister as in the previous error-handling code.
> 
> Signed-off-by: Julia Lawall <julia@...u.dk>
> 
> ---
> This is not tested, but I couldn't see how else platform_device_unregister
> could be called.
> 
>  arch/x86/kernel/microcode_core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
> index f924280..1872a3a 100644
> --- a/arch/x86/kernel/microcode_core.c
> +++ b/arch/x86/kernel/microcode_core.c
> @@ -532,8 +532,10 @@ static int __init microcode_init(void)
>  	}
>  
>  	error = microcode_dev_init();
> -	if (error)
> +	if (error) {
> +		platform_device_unregister(microcode_pdev);
>  		return error;
> +	}
>  
>  	register_syscore_ops(&mc_syscore_ops);
>  	register_hotcpu_notifier(&mc_cpu_notifier);

I guess the most sensible thing to do here is to convert this to the
classic goto with labels kernel style:

	...
	error = sysdev_driver_register(..);
	mutex_unlock(&microcode_mutex);
	put_online_cpus();
	if (error)
		goto err_sysdev;

	error = microcode_dev_init();
	if (error)
		goto err_dev;

	...

err_dev:
        get_online_cpus();
        mutex_lock(&microcode_mutex);

        sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);

        mutex_unlock(&microcode_mutex);
        put_online_cpus();


err_sysdev:
	platform_device_unregister(microcode_pdev);

out:
	return err;

or something to that effect.

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ