device-mapper-multipath-0.8.7-33
Add 0122-libmultipath-fix-ontap-prioritizer-snprintf-limits.patch Resolves: RHEL-58920
This commit is contained in:
parent
119f215010
commit
09b1d6a12a
@ -0,0 +1,77 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||||
|
Date: Wed, 7 Aug 2024 18:59:10 -0400
|
||||||
|
Subject: [PATCH] libmultipath: fix ontap prioritizer snprintf limits
|
||||||
|
|
||||||
|
The ontap prioritizer functions dump_cdb() and process_sg_error() both
|
||||||
|
incorrectly set the snprintf() limits larger than the available space.
|
||||||
|
Instead of multiplying the number of elements to print by the size of an
|
||||||
|
element to calculate the limit, they multiplied the number of elements
|
||||||
|
to print by the maximum number of elements that the buffer could hold.
|
||||||
|
|
||||||
|
Fix this by making these functions use strbufs instead.
|
||||||
|
|
||||||
|
mwilck: removed log message in print_strbuf() failure case.
|
||||||
|
|
||||||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||||
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
||||||
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
||||||
|
---
|
||||||
|
libmultipath/prioritizers/ontap.c | 24 +++++++++++-------------
|
||||||
|
1 file changed, 11 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c
|
||||||
|
index 262e69d2..80ab6ee4 100644
|
||||||
|
--- a/libmultipath/prioritizers/ontap.c
|
||||||
|
+++ b/libmultipath/prioritizers/ontap.c
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
#include "prio.h"
|
||||||
|
#include "structs.h"
|
||||||
|
#include "unaligned.h"
|
||||||
|
+#include "strbuf.h"
|
||||||
|
|
||||||
|
#define INQUIRY_CMD 0x12
|
||||||
|
#define INQUIRY_CMDLEN 6
|
||||||
|
@@ -36,32 +37,29 @@
|
||||||
|
static void dump_cdb(unsigned char *cdb, int size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
- char buf[10*5+1];
|
||||||
|
- char * p = &buf[0];
|
||||||
|
+ STRBUF_ON_STACK(buf);
|
||||||
|
|
||||||
|
- condlog(0, "- SCSI CDB: ");
|
||||||
|
- for (i=0; i<size; i++) {
|
||||||
|
- p += snprintf(p, 10*(size-i), "0x%02x ", cdb[i]);
|
||||||
|
+ for (i = 0; i < size; i++) {
|
||||||
|
+ if (print_strbuf(&buf, "0x%02x ", cdb[i]) < 0)
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
- condlog(0, "%s", buf);
|
||||||
|
+ condlog(0, "- SCSI CDB: %s", get_strbuf_str(&buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void process_sg_error(struct sg_io_hdr *io_hdr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
- char buf[128*5+1];
|
||||||
|
- char * p = &buf[0];
|
||||||
|
+ STRBUF_ON_STACK(buf);
|
||||||
|
|
||||||
|
condlog(0, "- masked_status=0x%02x, host_status=0x%02x, "
|
||||||
|
"driver_status=0x%02x", io_hdr->masked_status,
|
||||||
|
io_hdr->host_status, io_hdr->driver_status);
|
||||||
|
if (io_hdr->sb_len_wr > 0) {
|
||||||
|
- condlog(0, "- SCSI sense data: ");
|
||||||
|
- for (i=0; i<io_hdr->sb_len_wr; i++) {
|
||||||
|
- p += snprintf(p, 128*(io_hdr->sb_len_wr-i), "0x%02x ",
|
||||||
|
- io_hdr->sbp[i]);
|
||||||
|
+ for (i = 0; i < io_hdr->sb_len_wr; i++) {
|
||||||
|
+ if (print_strbuf(&buf, "0x%02x ", io_hdr->sbp[i]) < 0)
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
- condlog(0, "%s", buf);
|
||||||
|
+ condlog(0, "- SCSI sense data: %s", get_strbuf_str(&buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
Name: device-mapper-multipath
|
Name: device-mapper-multipath
|
||||||
Version: 0.8.7
|
Version: 0.8.7
|
||||||
Release: 32%{?dist}
|
Release: 33%{?dist}
|
||||||
Summary: Tools to manage multipath devices using device-mapper
|
Summary: Tools to manage multipath devices using device-mapper
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://christophe.varoqui.free.fr/
|
URL: http://christophe.varoqui.free.fr/
|
||||||
@ -131,6 +131,7 @@ Patch0118: 0118-libmultipath-change-the-vend-prod-rev-printing.patch
|
|||||||
Patch0119: 0119-multipath-tools-man-pages-Add-format-wildcard-descri.patch
|
Patch0119: 0119-multipath-tools-man-pages-Add-format-wildcard-descri.patch
|
||||||
Patch0120: 0120-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch
|
Patch0120: 0120-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch
|
||||||
Patch0121: 0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch
|
Patch0121: 0121-multipathd-set-reply-length-to-zero-for-NULL-replies.patch
|
||||||
|
Patch0122: 0122-libmultipath-fix-ontap-prioritizer-snprintf-limits.patch
|
||||||
|
|
||||||
|
|
||||||
# runtime
|
# runtime
|
||||||
@ -334,6 +335,10 @@ fi
|
|||||||
%{_pkgconfdir}/libdmmp.pc
|
%{_pkgconfdir}/libdmmp.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 13 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-33
|
||||||
|
- Add 0122-libmultipath-fix-ontap-prioritizer-snprintf-limits.patch
|
||||||
|
- Resolves: RHEL-58920
|
||||||
|
|
||||||
* Mon Aug 5 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-32
|
* Mon Aug 5 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-32
|
||||||
- Modify bindings, find_multipaths, and user_friendly_names tests
|
- Modify bindings, find_multipaths, and user_friendly_names tests
|
||||||
* Fixes RHEL-28068 & RHEL-4459
|
* Fixes RHEL-28068 & RHEL-4459
|
||||||
|
Loading…
Reference in New Issue
Block a user