]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple()
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 9 Jan 2023 10:51:20 +0000 (11:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:42:01 +0000 (11:42 +0100)
commit e3f360db08d55a14112bd27454e616a24296a8b0 upstream.

Make sure that *ptr__ within arch_this_cpu_to_op_simple() is only
dereferenced once by using READ_ONCE(). Otherwise the compiler could
generate incorrect code.

Cc: <stable@vger.kernel.org>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/percpu.h

index 918f0ba4f4d20f9934929639dcd4190b0b0f5a1e..5e26e2c4641b47ee0804f66c363dc7f12e08ed91 100644 (file)
@@ -31,7 +31,7 @@
        pcp_op_T__ *ptr__;                                              \
        preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
-       prev__ = *ptr__;                                                \
+       prev__ = READ_ONCE(*ptr__);                                     \
        do {                                                            \
                old__ = prev__;                                         \
                new__ = old__ op (val);                                 \