linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton@enomsg.org>
To: Shuah Khan <shuah.kh@samsung.com>
Cc: len.brown@intel.com, pavel@ucw.cz, rjw@rjwysocki.net,
	gregkh@linuxfoundation.org, dwmw2@infradead.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	shuahkhan@gmail.com
Subject: Re: [PATCH 0/2] power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate
Date: Tue, 19 Nov 2013 13:11:21 -0800	[thread overview]
Message-ID: <20131119211121.GA20193@teo> (raw)
In-Reply-To: <cover.1384875691.git.shuah.kh@samsung.com>

On Tue, Nov 19, 2013 at 08:59:34AM -0700, Shuah Khan wrote:
> 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 dereferences ws->name.
> 
> This patch series fixes power_supply_register() to initialize the device name
> prior to calling device_init_wakeup() and adds WARN_ON on null device name to
> device_wakeup_enable() to detect driver bugs that result in calling
> device_wakeup_enable() before device is fully initialized with its name in
> device_wakeup_enable().
> 
> It is important that these two fixes to be pulled in together as a series. The
> change to add WARN_ON on null device name without the power_supply_register()
> fix will result in early boot panics when AC Adapter and Battery device drivers
> try to register wakeup source.

I am all for it, so for the power_supply part:

Acked-by: Anton Vorontsov <anton@enomsg.org>

  parent reply	other threads:[~2013-11-19 21:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 15:59 [PATCH 0/2] power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate Shuah Khan
2013-11-19 15:59 ` [PATCH 1/2] " Shuah Khan
2013-11-19 23:13   ` Greg KH
2013-11-19 23:59     ` Shuah Khan
2013-11-19 16:05 ` [PATCH 2/2] power: Change device_wakeup_enable() to WARN_ON on null dev_name(dev) Shuah Khan
2013-11-19 23:14   ` Greg KH
2013-11-19 23:56     ` Rafael J. Wysocki
2013-11-19 23:52       ` Shuah Khan
2013-11-20  0:05         ` Greg KH
2013-11-20  0:12         ` Rafael J. Wysocki
2013-11-20  0:17           ` Rafael J. Wysocki
2013-11-19 21:11 ` Anton Vorontsov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-21  1:40 [PATCH 0/2] power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131119211121.GA20193@teo \
    --to=anton@enomsg.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=shuah.kh@samsung.com \
    --cc=shuahkhan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).