lkml.org 
[lkml]   [2013]   [Nov]   [30]   [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
2013-11-29 21:56, Borislav Petkov:
> 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...?
>

Yup, I have been staring at it.

> 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.
>

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.

--
Regards,
Levente Kurusa


\
 
 \ /
  Last update: 2013-11-30 09:21    [W:1.732 / U:1.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site