[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200616153110.626629451@linuxfoundation.org>
Date: Tue, 16 Jun 2020 17:34:13 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Alexander Gordeev <agordeev@...ux.ibm.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Yury Norov <yury.norov@...il.com>,
Amritha Nambiar <amritha.nambiar@...el.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Kees Cook <keescook@...omium.org>,
Matthew Wilcox <willy@...radead.org>,
Miklos Szeredi <mszeredi@...hat.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Steffen Klassert <steffen.klassert@...unet.com>,
"Tobin C . Harding" <tobin@...nel.org>,
Vineet Gupta <vineet.gupta1@...opsys.com>,
Will Deacon <will.deacon@....com>,
Willem de Bruijn <willemb@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 5.7 079/163] lib: fix bitmap_parse() on 64-bit big endian archs
From: Alexander Gordeev <agordeev@...ux.ibm.com>
commit 81c4f4d924d5d009b5ed785a3e22b18d0f7b831f upstream.
Commit 2d6261583be0 ("lib: rework bitmap_parse()") does not take into
account order of halfwords on 64-bit big endian architectures. As
result (at least) Receive Packet Steering, IRQ affinity masks and
runtime kernel test "test_bitmap" get broken on s390.
[andriy.shevchenko@...ux.intel.com: convert infinite while loop to a for loop]
Link: http://lkml.kernel.org/r/20200609140535.87160-1-andriy.shevchenko@linux.intel.com
Fixes: 2d6261583be0 ("lib: rework bitmap_parse()")
Signed-off-by: Alexander Gordeev <agordeev@...ux.ibm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Yury Norov <yury.norov@...il.com>
Cc: Amritha Nambiar <amritha.nambiar@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Chris Wilson <chris@...is-wilson.co.uk>
Cc: Kees Cook <keescook@...omium.org>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Miklos Szeredi <mszeredi@...hat.com>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Steffen Klassert <steffen.klassert@...unet.com>
Cc: "Tobin C . Harding" <tobin@...nel.org>
Cc: Vineet Gupta <vineet.gupta1@...opsys.com>
Cc: Will Deacon <will.deacon@....com>
Cc: Willem de Bruijn <willemb@...gle.com>
Cc: <stable@...r.kernel.org>
Link: http://lkml.kernel.org/r/1591634471-17647-1-git-send-email-agordeev@linux.ibm.com
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
lib/bitmap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -740,8 +740,9 @@ int bitmap_parse(const char *start, unsi
int chunks = BITS_TO_U32(nmaskbits);
u32 *bitmap = (u32 *)maskp;
int unset_bit;
+ int chunk;
- while (1) {
+ for (chunk = 0; ; chunk++) {
end = bitmap_find_region_reverse(start, end);
if (start > end)
break;
@@ -749,7 +750,11 @@ int bitmap_parse(const char *start, unsi
if (!chunks--)
return -EOVERFLOW;
- end = bitmap_get_x32_reverse(start, end, bitmap++);
+#if defined(CONFIG_64BIT) && defined(__BIG_ENDIAN)
+ end = bitmap_get_x32_reverse(start, end, &bitmap[chunk ^ 1]);
+#else
+ end = bitmap_get_x32_reverse(start, end, &bitmap[chunk]);
+#endif
if (IS_ERR(end))
return PTR_ERR(end);
}
Powered by blists - more mailing lists