From: Greg Kroah-Hartman Date: Thu, 13 Jun 2024 11:01:23 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.19.316~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a84be0c65b59458611e4779cf56bfdbc29ee9548;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: nfs-fix-undefined-behavior-in-nfs_block_bits.patch --- diff --git a/queue-5.4/nfs-fix-undefined-behavior-in-nfs_block_bits.patch b/queue-5.4/nfs-fix-undefined-behavior-in-nfs_block_bits.patch new file mode 100644 index 00000000000..c1500bed02b --- /dev/null +++ b/queue-5.4/nfs-fix-undefined-behavior-in-nfs_block_bits.patch @@ -0,0 +1,38 @@ +From 3c0a2e0b0ae661457c8505fecc7be5501aa7a715 Mon Sep 17 00:00:00 2001 +From: Sergey Shtylyov +Date: Fri, 10 May 2024 23:24:04 +0300 +Subject: nfs: fix undefined behavior in nfs_block_bits() + +From: Sergey Shtylyov + +commit 3c0a2e0b0ae661457c8505fecc7be5501aa7a715 upstream. + +Shifting *signed int* typed constant 1 left by 31 bits causes undefined +behavior. Specify the correct *unsigned long* type by using 1UL instead. + +Found by Linux Verification Center (linuxtesting.org) with the Svace static +analysis tool. + +Cc: stable@vger.kernel.org +Signed-off-by: Sergey Shtylyov +Reviewed-by: Benjamin Coddington +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman +--- + fs/nfs/internal.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/nfs/internal.h ++++ b/fs/nfs/internal.h +@@ -609,9 +609,9 @@ unsigned long nfs_block_bits(unsigned lo + if ((bsize & (bsize - 1)) || nrbitsp) { + unsigned char nrbits; + +- for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--) ++ for (nrbits = 31; nrbits && !(bsize & (1UL << nrbits)); nrbits--) + ; +- bsize = 1 << nrbits; ++ bsize = 1UL << nrbits; + if (nrbitsp) + *nrbitsp = nrbits; + } diff --git a/queue-5.4/series b/queue-5.4/series index 5b4f087e0ad..b46b4e7f8f6 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -199,3 +199,4 @@ xsk-validate-user-input-for-xdp_-umem-completion-_fill_ring.patch sparc-move-struct-termio-to-asm-termios.h.patch ext4-fix-mb_cache_entry-s-e_refcnt-leak-in-ext4_xattr_block_cache_find.patch s390-ap-fix-crash-in-ap-internal-function-modify_bitmap.patch +nfs-fix-undefined-behavior-in-nfs_block_bits.patch