linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: anton@samba.org
Subject: Re: powerpc/64: Fix atomic64_inc_not_zero() to return an int
Date: Thu, 13 Jul 2017 22:46:43 +1000 (AEST)	[thread overview]
Message-ID: <3x7bDM6dDgz9sNw@ozlabs.org> (raw)
In-Reply-To: <1499775054-631-1-git-send-email-mpe@ellerman.id.au>

On Tue, 2017-07-11 at 12:10:54 UTC, Michael Ellerman wrote:
> Although it's not documented anywhere, there is an expectation that
> atomic64_inc_not_zero() returns a result which fits in an int. This is
> the behaviour implemented on all arches except powerpc.
> 
> This has caused at least one bug in practice, in the percpu-refcount
> code, where the long result from our atomic64_inc_not_zero() was
> truncated to an int leading to lost references and stuck systems. That
> was worked around in that code in commit 966d2b04e070 ("percpu-refcount:
> fix reference leak during percpu-atomic transition").
> 
> To the best of my grepping abilities there are no other callers
> in-tree which truncate the value, but we should fix it anyway. Because
> the breakage is subtle and potentially very harmful I'm also tagging
> it for stable.
> 
> Code generation is largely unaffected because in most cases the
> callers are just using the result for a test anyway. In particular the
> case of fget() that was mentioned in commit a6cf7ed5119f
> ("powerpc/atomic: Implement atomic*_inc_not_zero") generates exactly
> the same code.
> 
> Fixes: a6cf7ed5119f ("powerpc/atomic: Implement atomic*_inc_not_zero")
> Cc: stable@vger.kernel.org # v3.4
> Noticed-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/01e6a61aceb82e13bec29502a8eb70

cheers

      reply	other threads:[~2017-07-13 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 12:10 [PATCH] powerpc/64: Fix atomic64_inc_not_zero() to return an int Michael Ellerman
2017-07-13 12:46 ` Michael Ellerman [this message]

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=3x7bDM6dDgz9sNw@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).