lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpok+b36_7SAUZmgM6jdtiWNu01u_0U4zQqE1b3B4xh0Svw@mail.gmail.com>
Date:	Tue, 16 Dec 2014 11:03:33 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Dmitry Torokhov <dtor@...omium.org>
Cc:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Shawn Guo <shawn.guo@...escale.com>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Anson Huang <b20788@...escale.com>,
	John Tobias <john.tobias.ph@...il.com>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpufreq: imx6: prorect calls to dev_pm_opp_get_opp_count
 with RCU lock

On 16 December 2014 at 06:20, Dmitry Torokhov <dtor@...omium.org> wrote:
> dev_pm_opp_get_opp_count() must be called with RCU lock held.
>
> Signed-off-by: Dmitry Torokhov <dtor@...omium.org>
> ---
>
> Not tested at all...
>
>  drivers/cpufreq/imx6q-cpufreq.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
> index 380a90d..851d4fd 100644
> --- a/drivers/cpufreq/imx6q-cpufreq.c
> +++ b/drivers/cpufreq/imx6q-cpufreq.c
> @@ -200,7 +200,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
>          * Just, incase the platform did not supply the OPP
>          * table, it will try to get it.
>          */
> +       rcu_read_lock();
>         num = dev_pm_opp_get_opp_count(cpu_dev);
> +       rcu_read_unlock();
>         if (num < 0) {
>                 ret = of_init_opp_table(cpu_dev);
>                 if (ret < 0) {
> @@ -211,7 +213,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
>                 /* Because we have added the OPPs here, we must free them */
>                 free_opp = true;
>
> +               rcu_read_lock();
>                 num = dev_pm_opp_get_opp_count(cpu_dev);
> +               rcu_read_unlock();
>                 if (num < 0) {
>                         ret = num;
>                         dev_err(cpu_dev, "no OPP table is found: %d\n", ret);

This one looks fine for sure but I was wondering for the users which just
need to call opp-count from under the locks, what about something like:

dev_pm_opp_get_opp_count_locked() ?

--
viresh
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ