From: "Menon, Nishanth" <nm@ti.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Kevin Hilman <khilman@deeprootsystems.com>
Subject: Re: [PATCH] power: opp: Fix rcu_dereference_check() without protection!
Date: Tue, 14 Jun 2011 10:38:37 -0500 [thread overview]
Message-ID: <BANLkTimKHsGCrbZ5FhYOyJC8+pASUD-nDg@mail.gmail.com> (raw)
In-Reply-To: <1308056600-17601-1-git-send-email-santosh.shilimkar@ti.com>
On Tue, Jun 14, 2011 at 08:03, Santosh Shilimkar
<santosh.shilimkar@ti.com> wrote:
> With RCU debug options enabled, below warning is observed.
>
> ===================================================
> [ INFO: suspicious rcu_dereference_check() usage. ]
> ---------------------------------------------------
> drivers/base/power/opp.c:151 invoked rcu_dereference_check() without protection!
>
> other info that might help us debug this:
>
> rcu_scheduler_active = 1, debug_locks = 1
> no locks held by swapper/1.
> ...
>
> ---------------------------------------------------
>
> Fix the same by protecting it with rcu_read lock.
>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> ---
> drivers/base/power/opp.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index 56a6899..cbed5e1 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -148,7 +148,9 @@ unsigned long opp_get_voltage(struct opp *opp)
> struct opp *tmp_opp;
> unsigned long v = 0;
>
> + rcu_read_lock();
> tmp_opp = rcu_dereference(opp);
> + rcu_read_unlock();
> if (unlikely(IS_ERR_OR_NULL(tmp_opp)) || !tmp_opp->available)
> pr_err("%s: Invalid parameters\n", __func__);
> else
NAK. please read the Documentation/power/opp.txt
the usage is as follows:
rcu_read_lock();
opp = opp_find_freq_ceil();
voltage = opp_get_voltage(opp);
rcu_read_unlock();
the reason for this is that the opp pointer is not safe if we lock
just the dereferencing.
Regards,
Nishanth Menon
next prev parent reply other threads:[~2011-06-14 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 13:03 Santosh Shilimkar
2011-06-14 15:38 ` Menon, Nishanth [this message]
2011-06-15 6:20 ` Santosh Shilimkar
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=BANLkTimKHsGCrbZ5FhYOyJC8+pASUD-nDg@mail.gmail.com \
--to=nm@ti.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
--cc=santosh.shilimkar@ti.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
all inboxes | Powered by JetHome®