[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <52878F17.6020104@samsung.com>
Date: Sat, 16 Nov 2013 08:28:23 -0700
From: Shuah Khan <shuah.kh@...sung.com>
To: Greg KH <gregkh@...uxfoundation.org>, anton@...msg.org,
dwmw2@...radead.org
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>, len.brown@...el.com,
pavel@....cz, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, shuahkhan@...il.com,
stable@...r.kernel.org, Shuah Khan <shuah.kh@...sung.com>
Subject: Re: [PATCH] power: Change device_wakeup_enable() to check for null
dev_name(dev)
On 11/15/2013 05:25 PM, Greg KH wrote:
> On Fri, Nov 15, 2013 at 05:16:31PM -0700, Shuah Khan wrote:
>> On 11/15/2013 05:21 PM, Rafael J. Wysocki wrote:
>>> On Friday, November 15, 2013 05:03:57 PM Shuah Khan wrote:
>>>> device_wakeup_enable() uses dev_name(dev) as the wakeup source name.
>>>> When it gets called with a device with its name not yet set, ws structure
>>>> with ws->name = NULL gets created.
>>>>
>>>> When kernel is booted with wakeup_source_activate enabled, it will panic
>>>> when the trace point code tries to derefernces ws->name.
>>>>
>>>> Change device_wakeup_enable() to check for dev_name(dev) null condition
>>>> and return -EINVAL to avoid panics when device_wakeup_enable() gets called
>>>> before device is fully initialized with its name.
>> return -EINVAL;
>>>
>>> Can you please use WARN_ON(!dev_name(dev)) here? While I agree that it is a
>>> bad idea to crash the kernel because dev has no name, that indicates a driver
>>> bug that shouldn't be too easy to ignore.
>>>
>>> Thanks!
>>>
>>
>> Right. ok I will re-cut the patch with WARN_ON and send it. fyi I did
>> send fix for the driver (power_supply) as well.
>>
>> http://www.kernelhub.org/?msg=362354&p=2
>
> Why is a driver calling kobject_set_name() instead of device_set_name()?
>
> Yes, it's really the same thing deep down, but drivers should never care
> about a kobject, just 'struct device'. Well, even then it usually
> should care about it's type of 'struct device' but that's a different
> issue...
>
> Anyway, not saying your patch is wrong at all, just for the future if
> people are looking for code cleanups...
>
Use of kobject_set_name() did look odd to me. I will fix that for this
driver by re-doing the patch while I am it. About the power_supply
patch, stable needs fixing as well, and I will have to backport once he
fix goes into the mainline.
http://www.kernelhub.org/?msg=362354&p=2 as is doesn't apply to 3.10 and
3.11
-- Shuah
--
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@...sung.com | (970) 672-0658
--
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