lkml.org 
[lkml]   [2013]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: mcheck: call put_device on device_register failure
On Sat, Nov 30, 2013 at 12:12:14PM +0100, Borislav Petkov wrote:
> Date: Sat, 30 Nov 2013 12:12:14 +0100
> 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
> User-Agent: Mutt/1.5.21 (2010-09-15)
>
> On Sat, Nov 30, 2013 at 08:30:33AM +0100, Levente Kurusa wrote:
> > No, if the call to put_device gives up the last reference to the
> > device, then device_release gets called which in turn frees the memory
> > associated with it. In this case, mce_device_release() will get
> > called, which is just a simple kfree call.
>
> Aah, that's that delayed freeing the driver core does, right. Now you
> made me go and look into detail:
>
> device_unregister
> |->put_device
> |->kobject_put
> |->kref_put(&kobj->kref, kobject_release)
> |->kref_sub(kref, 1, release)
> |->release
> |->kobject_release
> |->kobject_cleanup
> |->t->release
> |->device_release
> |->mce_device_release
>
>
> Ok, I see it now. :-) :-)
>
> Thanks, I'll take your patch as-is.
>

I have some concerns about it. if device_register is failed, it will
backtraces all kinds of conditions automatically, including put_device
definately. So do we really need an extra put_device when it returns
failure?
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-12-03 04:21    [W:0.066 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site