]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Jun 2024 11:01:07 +0000 (13:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Jun 2024 11:01:07 +0000 (13:01 +0200)
added patches:
nfs-fix-undefined-behavior-in-nfs_block_bits.patch

queue-4.19/nfs-fix-undefined-behavior-in-nfs_block_bits.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/nfs-fix-undefined-behavior-in-nfs_block_bits.patch b/queue-4.19/nfs-fix-undefined-behavior-in-nfs_block_bits.patch
new file mode 100644 (file)
index 0000000..fa8a3d8
--- /dev/null
@@ -0,0 +1,38 @@
+From 3c0a2e0b0ae661457c8505fecc7be5501aa7a715 Mon Sep 17 00:00:00 2001
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+Date: Fri, 10 May 2024 23:24:04 +0300
+Subject: nfs: fix undefined behavior in nfs_block_bits()
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+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 <s.shtylyov@omp.ru>
+Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/internal.h |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfs/internal.h
++++ b/fs/nfs/internal.h
+@@ -615,9 +615,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;
+       }
index 3e7a7d60f28a5a698ebc73f3740dbc31b852bec3..3c75a824e153007640f189822fe36df8524de164 100644 (file)
@@ -210,3 +210,4 @@ net-fix-__dst_negative_advice-race.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