lkml.org 
[lkml]   [2013]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] power: Change device_wakeup_enable() to check for null dev_name(dev)
Date
On Friday, November 15, 2013 05:16:31 PM 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

That's OK (thanks for taking care of this), but there may be more brilliant
stuff like that in the future and people should see right away that something's
wrong in those cases.

Rafael



\
 
 \ /
  Last update: 2013-11-16 01:41    [W:0.102 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site