linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate
@ 2013-11-21  1:40 Shuah Khan
  2013-11-21  1:40 ` [PATCH 1/2] " Shuah Khan
  2013-11-21  1:40 ` [PATCH 2/2] PM: Fix Oops from NULL pointer dereference in wakeup_source_activate Shuah Khan
  0 siblings, 2 replies; 6+ messages in thread
From: Shuah Khan @ 2013-11-21  1:40 UTC (permalink / raw)
  To: len.brown, pavel, rjw, gregkh, anton, dwmw2
  Cc: Shuah Khan, linux-pm, linux-kernel, shuahkhan

power_supply_register() calls device_init_wakeup() to register a wakeup
source before initializing dev_name. As a result, device_wakeup_enable()
end up registering wakeup source with a null name when wakeup_source_register()
gets called with dev_name(dev) which is null at the time.

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 dereference ws->name. Registering a
a wakeup source without a name should be possible.

This patch series fixes power_supply_register() to initialize the device name
prior to calling device_init_wakeup() and fixes wakeup_source_activate
tracepoint to check for null name and handle it gracefully by just using
"(no name)" as the name string for the source.

These two patches are not dependent, I left them as a series since the original
discussion started the fixes grouped in a series.

power_supply patch - no changes since series patch v1, other than including
Acked-by from Greg and Anton. Also added stable tag.

Second patch now is the fix to tracepoint code. This fix is definitely better
than adding WARN_ON to device_wakeup_enable(). It removes the dependency
between these two patches.

These patches can be applied independently with no ill effects. I included
the trace for the wakeup_source_activate trace output in the changelogs for
both patches.

Shuah Khan (2):
  power_supply: Fix Oops from NULL pointer dereference from
    wakeup_source_activate
  PM: Fix Oops from NULL pointer dereference in wakeup_source_activate

 drivers/power/power_supply_core.c | 12 ++++++------
 include/trace/events/power.h      |  6 ++++--
 2 files changed, 10 insertions(+), 8 deletions(-)

-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-21 18:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21  1:40 [PATCH 0/2] power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate Shuah Khan
2013-11-21  1:40 ` [PATCH 1/2] " Shuah Khan
2013-11-21  1:40 ` [PATCH 2/2] PM: Fix Oops from NULL pointer dereference in wakeup_source_activate Shuah Khan
2013-11-21  2:01   ` Shuah Khan
2013-11-21  2:26     ` Steven Rostedt
2013-11-21 18:02       ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).