public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Safonov <0x7f454c46@gmail.com>
To: Jason Baron <jbaron@akamai.com>, Dmitry Safonov <dima@arista.com>,
	linux-kernel@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	Eric Dumazet <edumazet@google.com>
Cc: Bob Gilligan <gilligan@arista.com>,
	"David S. Miller" <davem@davemloft.net>,
	Francesco Ruggeri <fruggeri@arista.com>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Salam Noureddine <noureddine@arista.com>,
	netdev@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v3 1/3] jump_label: Prevent key->enabled int overflow
Date: Mon, 14 Nov 2022 17:13:51 +0000	[thread overview]
Message-ID: <96cb7d74-a3e1-10d0-0af2-2b845b6da0ae@gmail.com> (raw)
In-Reply-To: <ae9e4333-7070-d550-c0b5-f4d122d2f025@akamai.com>

On 11/14/22 16:24, Jason Baron wrote:
> 
[..]
>> @@ -148,16 +167,23 @@ void static_key_slow_inc_cpuslocked(struct static_key *key)
>>  		 */
>>  		atomic_set_release(&key->enabled, 1);
>>  	} else {
>> -		atomic_inc(&key->enabled);
>> +		if (WARN_ON_ONCE(static_key_fast_inc(key))) {
> 
> Shouldn't that be negated to catch the overflow:
> 
> if (WARN_ON_ONCE(!static_key_fast_inc(key)))

Oh, that's just embarrassing!
I wonder how did I miss it during tests..

Thanks for spotting this, will fix in v4,
            Dmitry

  reply	other threads:[~2022-11-14 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 21:23 [PATCH v3 0/3] net/tcp: Dynamically disable TCP-MD5 static key Dmitry Safonov
2022-11-11 21:23 ` [PATCH v3 1/3] jump_label: Prevent key->enabled int overflow Dmitry Safonov
2022-11-12 10:03   ` Peter Zijlstra
2022-11-14 15:47     ` Dmitry Safonov
2022-11-14 16:24   ` Jason Baron
2022-11-14 17:13     ` Dmitry Safonov [this message]
2022-11-11 21:23 ` [PATCH v3 2/3] net/tcp: Separate tcp_md5sig_info allocation into tcp_md5sig_info_add() Dmitry Safonov
2022-11-11 21:23 ` [PATCH v3 3/3] net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction Dmitry Safonov

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=96cb7d74-a3e1-10d0-0af2-2b845b6da0ae@gmail.com \
    --to=0x7f454c46@gmail.com \
    --cc=ardb@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dima@arista.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fruggeri@arista.com \
    --cc=gilligan@arista.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noureddine@arista.com \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=yoshfuji@linux-ipv6.org \
    /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