]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 09:31:48 +0000 (10:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 09:31:48 +0000 (10:31 +0100)
added patches:
cifs-prevent-copying-past-input-buffer-boundaries.patch

queue-5.15/cifs-prevent-copying-past-input-buffer-boundaries.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/cifs-prevent-copying-past-input-buffer-boundaries.patch b/queue-5.15/cifs-prevent-copying-past-input-buffer-boundaries.patch
new file mode 100644 (file)
index 0000000..1a51942
--- /dev/null
@@ -0,0 +1,42 @@
+From 9ee2afe5207b63b20426ee081f486d831bae871d Mon Sep 17 00:00:00 2001
+From: Paulo Alcantara <pc@cjr.nz>
+Date: Thu, 6 Oct 2022 13:04:05 -0300
+Subject: cifs: prevent copying past input buffer boundaries
+
+From: Paulo Alcantara <pc@cjr.nz>
+
+commit 9ee2afe5207b63b20426ee081f486d831bae871d upstream.
+
+Prevent copying past @data buffer in smb2_validate_and_copy_iov() as
+the output buffer in @iov might be potentially bigger and thus copying
+more bytes than requested in @minbufsize.
+
+Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
+Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Cc: Georg Müller <georgmueller@gmx.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/smb2pdu.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/cifs/smb2pdu.c
++++ b/fs/cifs/smb2pdu.c
+@@ -3400,7 +3400,7 @@ smb2_validate_and_copy_iov(unsigned int
+       if (rc)
+               return rc;
+-      memcpy(data, begin_of_buf, buffer_length);
++      memcpy(data, begin_of_buf, minbufsize);
+       return 0;
+ }
+@@ -3524,7 +3524,7 @@ query_info(const unsigned int xid, struc
+       rc = smb2_validate_and_copy_iov(le16_to_cpu(rsp->OutputBufferOffset),
+                                       le32_to_cpu(rsp->OutputBufferLength),
+-                                      &rsp_iov, min_len, *data);
++                                      &rsp_iov, dlen ? *dlen : min_len, *data);
+       if (rc && allocated) {
+               kfree(*data);
+               *data = NULL;
index d8f81d57bcfc1f702a2a6b1e17254541d2b4a6f0..31cfb86b343f2c7dd283191c83a8eea3395b97fe 100644 (file)
@@ -174,3 +174,4 @@ ext4-don-t-set-up-encryption-key-during-jbd2-transaction.patch
 ext4-add-missing-validation-of-fast-commit-record-lengths.patch
 ext4-fix-unaligned-memory-access-in-ext4_fc_reserve_space.patch
 ext4-fix-off-by-one-errors-in-fast-commit-block-filling.patch
+cifs-prevent-copying-past-input-buffer-boundaries.patch