2b0cd7cceb
Rebased on top of Martin Wilck's queue of ACKed upstream commits * https://github.com/openSUSE/multipath-tools/tree/upstream-queue * All previous patches have been reordered, with the exception of 0011-libdmmp-Add-support-for-upcoming-json-c-0.14.0.patch which has been replaced with 0029-fix-boolean-value-with-json-c-0.14.patch Modify 0054-RH-add-mpathconf.patch * remove default enable_foreign and property blacklist_exceptions settings, and deal with the builtin default change from 0031-libmultipath-set-enable_foreign-to-NONE-by-default.patch. Fixes bz #1853668 Add 0048-Makefile.inc-trim-extra-information-from-systemd-ver.patch Add 0049-kpartx-fix-Wsign-compare-error.patch * The above two patches have been submitted upstream
55 lines
2.1 KiB
Diff
55 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Fri, 6 Mar 2020 23:46:47 +0100
|
|
Subject: [PATCH] libmpathpersist: mpath_format_readfullstatus(): use real
|
|
buffer size
|
|
|
|
This changes no semantics, but it will allow changing the size of
|
|
prin_readfd.private_buffer in a follow-up patch.
|
|
|
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmpathpersist/mpath_pr_ioctl.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/libmpathpersist/mpath_pr_ioctl.c b/libmpathpersist/mpath_pr_ioctl.c
|
|
index c78e8000..fadc9e10 100644
|
|
--- a/libmpathpersist/mpath_pr_ioctl.c
|
|
+++ b/libmpathpersist/mpath_pr_ioctl.c
|
|
@@ -238,6 +238,8 @@ static void mpath_format_readfullstatus(struct prin_resp *pr_buff)
|
|
uint32_t additional_length, k, tid_len_len = 0;
|
|
char tempbuff[MPATH_MAX_PARAM_LEN];
|
|
struct prin_fulldescr fdesc;
|
|
+ static const int pbuf_size =
|
|
+ sizeof(pr_buff->prin_descriptor.prin_readfd.private_buffer);
|
|
|
|
convert_be32_to_cpu(&pr_buff->prin_descriptor.prin_readfd.prgeneration);
|
|
convert_be32_to_cpu(&pr_buff->prin_descriptor.prin_readfd.number_of_descriptor);
|
|
@@ -249,16 +251,18 @@ static void mpath_format_readfullstatus(struct prin_resp *pr_buff)
|
|
}
|
|
|
|
additional_length = pr_buff->prin_descriptor.prin_readfd.number_of_descriptor;
|
|
- if (additional_length > MPATH_MAX_PARAM_LEN) {
|
|
+ if (additional_length > pbuf_size) {
|
|
condlog(3, "PRIN length %u exceeds max length %d", additional_length,
|
|
- MPATH_MAX_PARAM_LEN);
|
|
+ pbuf_size);
|
|
return;
|
|
}
|
|
|
|
memset(&fdesc, 0, sizeof(struct prin_fulldescr));
|
|
|
|
- memcpy( tempbuff, pr_buff->prin_descriptor.prin_readfd.private_buffer,MPATH_MAX_PARAM_LEN );
|
|
- memset(&pr_buff->prin_descriptor.prin_readfd.private_buffer, 0, MPATH_MAX_PARAM_LEN);
|
|
+ memcpy( tempbuff, pr_buff->prin_descriptor.prin_readfd.private_buffer,
|
|
+ pbuf_size);
|
|
+ memset(&pr_buff->prin_descriptor.prin_readfd.private_buffer, 0,
|
|
+ pbuf_size);
|
|
|
|
p =(unsigned char *)tempbuff;
|
|
ppbuff = (char *)pr_buff->prin_descriptor.prin_readfd.private_buffer;
|
|
--
|
|
2.17.2
|
|
|