public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Levente Kurusa <levex@linux.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tony Luck <tony.luck@intel.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, EDAC <linux-edac@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: mcheck: call put_device on device_register failure
Date: Fri, 29 Nov 2013 21:56:28 +0100	[thread overview]
Message-ID: <20131129205628.GA20144@pd.tnic> (raw)
In-Reply-To: <5298F900.9000208@linux.com>

On Fri, Nov 29, 2013 at 09:28:48PM +0100, Levente Kurusa wrote:
> This patch adds a call to put_device() when the device_register()
> call has failed. This is required so that the last reference to the
> device is given up.

I'd assume this is not something you're actually hitting but have caught
this by code staring...?

> Signed-off-by: Levente Kurusa <levex@linux.com>
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index b3218cd..a389c1d 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -2272,8 +2272,10 @@ static int mce_device_create(unsigned int cpu)
>  	dev->release = &mce_device_release;
> 
>  	err = device_register(dev);
> -	if (err)
> +	if (err) {
> +		put_device(dev);
>  		return err;
> +	}

If we're going to do this, I'd also like to see you add another label
after device_unregister(dev) which also kfrees dev because apparently
we're not doing that either.

Thanks.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2013-11-29 20:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 20:28 [PATCH] x86: mcheck: call put_device on device_register failure Levente Kurusa
2013-11-29 20:56 ` Borislav Petkov [this message]
2013-11-30  7:30   ` Levente Kurusa
2013-11-30 11:12     ` Borislav Petkov
2013-11-30 11:25       ` Levente Kurusa
2013-11-30 11:32         ` Borislav Petkov
2013-11-30 11:44           ` Levente Kurusa
2013-11-30 12:08             ` Borislav Petkov
2013-11-30 12:37               ` Levente Kurusa
2013-12-03  2:23       ` Chen, Gong
2013-12-03 17:01         ` Borislav Petkov
2013-12-04  7:38           ` Chen, Gong
2013-12-04 18:39             ` Levente Kurusa
2013-12-05  2:57               ` Chen, Gong
2013-12-05 11:18                 ` Levente Kurusa

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=20131129205628.GA20144@pd.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=levex@linux.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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