From: "Jan Beulich" <JBeulich@suse.com>
To: "Borislav Petkov" <bp@amd64.org>
Cc: <mingo@elte.hu>, <tglx@linutronix.de>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
<linux-kernel@vger.kernel.org>, <hpa@zytor.com>
Subject: Re: [PATCH] x86: fix error paths in microcode_init()
Date: Fri, 02 Dec 2011 14:53:18 +0000 [thread overview]
Message-ID: <4ED8F46E0200007800065178@nat28.tlf.novell.com> (raw)
In-Reply-To: <20111202143517.GA16690@gere.osrc.amd.com>
>>> On 02.12.11 at 15:35, Borislav Petkov <bp@amd64.org> wrote:
> Hi,
>
> On Fri, Dec 02, 2011 at 01:35:19PM +0000, Jan Beulich wrote:
>> After failure of platform_device_register_simple(), microcode_dev_exit()
>> got called without the call to microcode_dev_init() already having taken
>> place.
>>
>> After failure of microcode_dev_init(), no cleanup of previously carried
>> out setup was done at all.
>>
>> As a result, microcode_dev_exit() can now get __exit tagged on it.
>>
>> (Noticed while looking at the code, not because of having experienced
>> an actual problem.)
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> ---
>> arch/x86/kernel/microcode_core.c | 18 +++++++++++++-----
>> 1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> --- 3.2-rc4/arch/x86/kernel/microcode_core.c
>> +++ 3.2-rc4-x86-ucode-init-eh/arch/x86/kernel/microcode_core.c
>> @@ -256,7 +256,7 @@ static int __init microcode_dev_init(voi
>> return 0;
>> }
>>
>> -static void microcode_dev_exit(void)
>> +static void __exit microcode_dev_exit(void)
>> {
>> misc_deregister(µcode_dev);
>> }
>> @@ -519,10 +519,8 @@ static int __init microcode_init(void)
>>
>> microcode_pdev = platform_device_register_simple("microcode", -1,
>> NULL, 0);
>> - if (IS_ERR(microcode_pdev)) {
>> - microcode_dev_exit();
>> + if (IS_ERR(microcode_pdev))
>> return PTR_ERR(microcode_pdev);
>> - }
>>
>> get_online_cpus();
>> mutex_lock(µcode_mutex);
>> @@ -538,8 +536,18 @@ static int __init microcode_init(void)
>> }
>>
>> error = microcode_dev_init();
>> - if (error)
>> + if (error) {
>> + get_online_cpus();
>> + mutex_lock(µcode_mutex);
>> +
>> + sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);
>> +
>> + mutex_unlock(µcode_mutex);
>> + put_online_cpus();
>> +
>> + platform_device_unregister(microcode_pdev);
>> return error;
>> + }
>
> Actually, Srivatsa made a similar patch already which I sent to x86
> guys (I don't think they've pulled yet) but yours is additionally more
> careful to do proper locking before doing sysdev_driver_unregister().
>
> Would you like to add that part ontop of Srivatsa's patch at the
> out_sysdev_driver label and resend?
Why shouldn't this one be taken in its entirety instead?
Jan
next prev parent reply other threads:[~2011-12-02 14:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 12:35 [PATCH] x86 Microcode: Fix the failure path of microcode update driver init code Srivatsa S. Bhat
2011-11-07 18:02 ` Borislav Petkov
2011-12-02 13:35 ` [PATCH] x86: fix error paths in microcode_init() Jan Beulich
2011-12-02 14:35 ` Borislav Petkov
2011-12-02 14:53 ` Jan Beulich [this message]
2011-12-02 15:15 ` Srivatsa S. Bhat
2011-12-02 15:24 ` Borislav Petkov
2011-12-02 15:33 ` Jan Beulich
2011-12-02 16:40 ` Srivatsa S. Bhat
2011-12-02 16:45 ` Jan Beulich
2011-12-02 16:51 ` Srivatsa S. Bhat
2011-12-02 19:45 ` Borislav Petkov
2011-12-02 20:00 ` Srivatsa S. Bhat
2011-12-05 17:39 ` [tip:x86/urgent] x86, microcode: Fix the failure path of microcode update driver init code tip-bot for Srivatsa S. Bhat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ED8F46E0200007800065178@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=bp@amd64.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®