remarkable-linux/arch/powerpc
Michael Ellerman 01e6a61ace powerpc/64: Fix atomic64_inc_not_zero() to return an int
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 966d2b04e0 ("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 a6cf7ed511
("powerpc/atomic: Implement atomic*_inc_not_zero") generates exactly
the same code.

Fixes: a6cf7ed511 ("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>
2017-07-12 21:49:55 +10:00
..
boot powerpc updates for 4.13 2017-07-07 13:55:45 -07:00
configs powerpc/44x/fsp2: Add defconfig for FSP2 board 2017-05-30 14:59:51 +10:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-05-02 15:53:46 -07:00
include powerpc/64: Fix atomic64_inc_not_zero() to return an int 2017-07-12 21:49:55 +10:00
kernel powerpc/powernv: Fix local TLB flush for boot and MCE on POWER9 2017-07-11 12:53:53 +10:00
kvm powerpc updates for 4.13 2017-07-07 13:55:45 -07:00
lib powerpc: Fix emulation of mfocrf in emulate_step() 2017-07-12 16:43:48 +10:00
math-emu
mm powerpc/mm/radix: Synchronize updates to the process table 2017-07-10 21:26:31 +10:00
net bpf: Add jited_len to struct bpf_prog 2017-06-06 15:41:24 -04:00
oprofile
perf powerpc/perf: Add POWER9 alternate PM_RUN_CYC and PM_RUN_INST_CMPL events 2017-07-12 12:21:49 +10:00
platforms powerpc/powernv: Tell OPAL about our MMU mode on POWER9 2017-07-10 21:12:27 +10:00
purgatory
sysdev powerpc updates for 4.13 2017-07-07 13:55:45 -07:00
tools powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00
xmon powerpc/xmon: Add patch_instruction() support for xmon 2017-07-03 23:12:19 +10:00
Kconfig Kbuild thin archives updates for v4.13 2017-07-07 15:11:12 -07:00
Kconfig.debug
Makefile powerpc: Link warning for orphan sections 2017-05-30 14:59:51 +10:00
Makefile.postlink powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00