android_kernel_oneplus_msm8998/arch/parisc
John David Anglin 937a91cd39 parisc: Fix validity check of pointer size argument in new CAS implementation
commit 05f016d2ca7a4fab99d5d5472168506ddf95e74f upstream.

As noted by Christoph Biedl, passing a pointer size of 4 in the new CAS
implementation causes a kernel crash.  The attached patch corrects the
off by one error in the argument validity check.

In reviewing the code, I noticed that we only perform word operations
with the pointer size argument.  The subi instruction intentionally uses
a word condition on 64-bit kernels.  Nullification was used instead of a
cmpib instruction as the branch should never be taken.  The shlw
pseudo-operation generates a depw,z instruction and it clears the target
before doing a shift left word deposit.  Thus, we don't need to clip the
upper 32 bits of this argument on 64-bit kernels.

Tested with a gcc testsuite run with a 64-bit kernel.  The gcc atomic
code in libgcc is the only direct user of the new CAS implementation
that I am aware of.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-30 08:37:24 +00:00
..
configs rtmutex: Delete scriptable tester 2015-07-20 11:45:45 +02:00
include parisc/mm: Ensure IRQs are off in switch_mm() 2017-07-21 07:44:56 +02:00
kernel parisc: Fix validity check of pointer size argument in new CAS implementation 2017-11-30 08:37:24 +00:00
lib parisc: Unbreak handling exceptions from kernel modules 2016-04-20 15:41:52 +09:00
math-emu parisc: remove duplicate define 2013-11-07 22:28:15 +01:00
mm parisc: Report SIGSEGV instead of SIGBUS when running out of stack 2017-07-21 07:44:56 +02:00
oprofile
defpalo.conf parisc: switch to gzip-compressed vmlinuz kernel 2013-07-09 22:09:20 +02:00
install.sh parisc: make "make install" not depend on vmlinux 2013-11-07 22:28:06 +01:00
Kconfig parisc: Add Huge Page and HUGETLBFS support 2015-11-22 12:23:10 +01:00
Kconfig.debug consolidate per-arch stack overflow debugging options 2013-07-04 11:25:39 -07:00
Makefile Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:07:08 -08:00
nm