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

queue-5.10/nfs-fix-read_plus-when-server-doesn-t-support-op_read_plus.patch [new file with mode: 0644]
queue-5.10/nfs-fix-undefined-behavior-in-nfs_block_bits.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/nfs-fix-read_plus-when-server-doesn-t-support-op_read_plus.patch b/queue-5.10/nfs-fix-read_plus-when-server-doesn-t-support-op_read_plus.patch
new file mode 100644 (file)
index 0000000..5aa2376
--- /dev/null
@@ -0,0 +1,41 @@
+From f06d1b10cb016d5aaecdb1804fefca025387bd10 Mon Sep 17 00:00:00 2001
+From: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Date: Thu, 25 Apr 2024 16:24:29 -0400
+Subject: NFS: Fix READ_PLUS when server doesn't support OP_READ_PLUS
+
+From: Anna Schumaker <Anna.Schumaker@Netapp.com>
+
+commit f06d1b10cb016d5aaecdb1804fefca025387bd10 upstream.
+
+Olga showed me a case where the client was sending multiple READ_PLUS
+calls to the server in parallel, and the server replied
+NFS4ERR_OPNOTSUPP to each. The client would fall back to READ for the
+first reply, but fail to retry the other calls.
+
+I fix this by removing the test for NFS_CAP_READ_PLUS in
+nfs4_read_plus_not_supported(). This allows us to reschedule any
+READ_PLUS call that has a NFS4ERR_OPNOTSUPP return value, even after the
+capability has been cleared.
+
+Reported-by: Olga Kornievskaia <kolga@netapp.com>
+Fixes: c567552612ec ("NFS: Add READ_PLUS data segment support")
+Cc: stable@vger.kernel.org # v5.10+
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+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/nfs4proc.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -5320,7 +5320,7 @@ static bool nfs4_read_plus_not_supported
+       struct rpc_message *msg = &task->tk_msg;
+       if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_READ_PLUS] &&
+-          server->caps & NFS_CAP_READ_PLUS && task->tk_status == -ENOTSUPP) {
++          task->tk_status == -ENOTSUPP) {
+               server->caps &= ~NFS_CAP_READ_PLUS;
+               msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
+               rpc_restart_call_prepare(task);
diff --git a/queue-5.10/nfs-fix-undefined-behavior-in-nfs_block_bits.patch b/queue-5.10/nfs-fix-undefined-behavior-in-nfs_block_bits.patch
new file mode 100644 (file)
index 0000000..da55eee
--- /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
+@@ -660,9 +660,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 5a209e8ad11bd72bad5ad2410a041dacc7ecf743..5269ff654b35b3ed01f4d11b9a664a6fc13f25c4 100644 (file)
@@ -309,3 +309,5 @@ 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
+nfs-fix-read_plus-when-server-doesn-t-support-op_read_plus.patch