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]
Date:	Wed, 23 Jul 2014 13:14:19 -0400
From:	Pranith Kumar <bobby.prani@...il.com>
To:	Paul McKenney <paulmck@...ux.vnet.ibm.com>
Cc:	Josh Triplett <josh@...htriplett.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	"open list:READ-COPY UPDATE..." <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 02/16] rcu: Check return value for cpumask allocation

On Wed, Jul 23, 2014 at 8:06 AM, Paul E. McKenney
<paulmck@...ux.vnet.ibm.com> wrote:
>> --- a/kernel/rcu/tree_plugin.h
>> +++ b/kernel/rcu/tree_plugin.h
>> @@ -88,7 +88,10 @@ static void __init rcu_bootup_announce_oddness(void)
>>  #ifdef CONFIG_RCU_NOCB_CPU
>>  #ifndef CONFIG_RCU_NOCB_CPU_NONE
>>       if (!have_rcu_nocb_mask) {
>> -             zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
>> +             if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
>> +                     pr_info("rcu_nocb_mask allocation failed\n");
>> +                     return;
>
> Good catch, but this "return" is an accident waiting to happen.  The
> accident will happen as soon as another RCU option appears, and the
> person adding it quite naturally adds it at the end of this function.
> The cleanest approach is to make an rcu_bootup_announce_oddness_nocb()
> as one commit that does -only- code motion, and the make this change
> as another commit.
>

Hi Paul,

Looking at this, I think the following is simpler without having to
introduce a new function. What do you think?

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index c31eb28..f2ed342 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -88,8 +88,10 @@ static void __init rcu_bootup_announce_oddness(void)
 #ifdef CONFIG_RCU_NOCB_CPU
 #ifndef CONFIG_RCU_NOCB_CPU_NONE
        if (!have_rcu_nocb_mask) {
-               zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
-               have_rcu_nocb_mask = true;
+               if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL))
+                       pr_info("rcu_nocb_mask allocation failed");
+               else
+                       have_rcu_nocb_mask = true;
        }
 #ifdef CONFIG_RCU_NOCB_CPU_ZERO
        pr_info("\tOffload RCU callbacks from CPU 0\n");


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