]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jul 2021 15:36:37 +0000 (17:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jul 2021 15:36:37 +0000 (17:36 +0200)
added patches:
kfifo-declare_kifo_ptr-fifo-u64-does-not-work-on-arm-32-bit.patch

queue-4.14/kfifo-declare_kifo_ptr-fifo-u64-does-not-work-on-arm-32-bit.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/kfifo-declare_kifo_ptr-fifo-u64-does-not-work-on-arm-32-bit.patch b/queue-4.14/kfifo-declare_kifo_ptr-fifo-u64-does-not-work-on-arm-32-bit.patch
new file mode 100644 (file)
index 0000000..e6f53c3
--- /dev/null
@@ -0,0 +1,41 @@
+From 8a866fee3909c49738e1c4429a8d2b9bf27e015d Mon Sep 17 00:00:00 2001
+From: Sean Young <sean@mess.org>
+Date: Sun, 8 Oct 2017 12:12:16 -0400
+Subject: kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit
+
+From: Sean Young <sean@mess.org>
+
+commit 8a866fee3909c49738e1c4429a8d2b9bf27e015d upstream.
+
+If you try to store u64 in a kfifo (or a struct with u64 members),
+then the buf member of __STRUCT_KFIFO_PTR will cause 4 bytes
+padding due to alignment (note that struct __kfifo is 20 bytes
+on 32 bit).
+
+That in turn causes the __is_kfifo_ptr() to fail, which is caught
+by kfifo_alloc(), which now returns EINVAL.
+
+So, ensure that __is_kfifo_ptr() compares to the right structure.
+
+Signed-off-by: Sean Young <sean@mess.org>
+Acked-by: Stefani Seibold <stefani@seibold.net>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Matthew Weber <matthew.weber@collins.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/kfifo.h |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/include/linux/kfifo.h
++++ b/include/linux/kfifo.h
+@@ -113,7 +113,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PT
+  * array is a part of the structure and the fifo type where the array is
+  * outside of the fifo structure.
+  */
+-#define       __is_kfifo_ptr(fifo)    (sizeof(*fifo) == sizeof(struct __kfifo))
++#define       __is_kfifo_ptr(fifo) \
++      (sizeof(*fifo) == sizeof(STRUCT_KFIFO_PTR(typeof(*(fifo)->type))))
+ /**
+  * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object
index 7a57bd49bd2ec4a877e2ae3aa7acab403447e04f..6829ef67377fe6e36fdb888bd50bf4c44f13bff3 100644 (file)
@@ -19,3 +19,4 @@ mm-thp-another-pvmw_sync-fix-in-page_vma_mapped_walk.patch
 mm-futex-fix-shared-futex-pgoff-on-shmem-huge-page.patch
 scsi-sr-return-appropriate-error-code-when-disk-is-e.patch
 drm-nouveau-fix-dma_address-check-for-cpu-gpu-sync.patch
+kfifo-declare_kifo_ptr-fifo-u64-does-not-work-on-arm-32-bit.patch