diff --git a/6029-libmultipath-fix-files-read-from-config_dir.patch b/6029-libmultipath-fix-files-read-from-config_dir.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0b7c6a9daef511817192de5d861eaaf13ede19a --- /dev/null +++ b/6029-libmultipath-fix-files-read-from-config_dir.patch @@ -0,0 +1,41 @@ +From dbd6e0f8ad3d145c73175a6f99eab401408d9d54 Mon Sep 17 00:00:00 2001 +From: Enzo Matsumiya +Date: Fri, 7 Feb 2020 11:45:25 -0300 +Subject: [PATCH] libmultipath: fix files read from config_dir + +If config_dir contains a file named, for example, "some.conf.backup", this file +will still be loaded by multipath because process_config_dir() +(libmultipath/config.c) uses strstr() to check for the ".conf" extension, but +that doesn't guarantee that ".conf" is at the end of the filename. + +This patch will make sure that only files ending in ".conf" are loaded from +config_dir. + +This is to comply with config_dir entry description in man 5 multipath.conf. + +Signed-off-by: Enzo Matsumiya +--- + libmultipath/config.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libmultipath/config.c b/libmultipath/config.c +index 5af7af5..7c641a3 100644 +--- a/libmultipath/config.c ++++ b/libmultipath/config.c +@@ -669,8 +669,11 @@ process_config_dir(struct config *conf, vector keywords, char *dir) + sr.n = n; + pthread_cleanup_push_cast(free_scandir_result, &sr); + for (i = 0; i < n; i++) { +- if (!strstr(namelist[i]->d_name, ".conf")) ++ char *ext = strrchr(namelist[i]->d_name, '.'); ++ ++ if (!ext || strcmp(ext, ".conf")) + continue; ++ + old_hwtable_size = VECTOR_SIZE(conf->hwtable); + snprintf(path, LINE_MAX, "%s/%s", dir, namelist[i]->d_name); + path[LINE_MAX-1] = '\0'; +-- +1.8.3.1 + + diff --git a/6030-libmultipath-fix-sgio_get_vpd-looping.patch b/6030-libmultipath-fix-sgio_get_vpd-looping.patch new file mode 100644 index 0000000000000000000000000000000000000000..9fa294b969abd8704d59cb0bd77f77b7be1bb144 --- /dev/null +++ b/6030-libmultipath-fix-sgio_get_vpd-looping.patch @@ -0,0 +1,50 @@ +From b3d65f57bc63ccfc52b89adb7ab7c0bc659c00af Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Wed, 19 Feb 2020 00:48:29 -0600 +Subject: [PATCH] libmultipath: fix sgio_get_vpd looping + +If do_inq returns a page with a length that is less than maxlen, but +larger than DEFAULT_SGIO_LEN, this function will loop forever. Also +if do_inq returns with a length equal to or greater than maxlen, +sgio_get_vpd will exit immediately, even if it hasn't read the entire +page. Fix these issues, modify the tests to verify the new behavior. + +Signed-off-by: Benjamin Marzinski +--- + libmultipath/discovery.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c +index a4769ee..400959d 100644 +--- a/libmultipath/discovery.c ++++ b/libmultipath/discovery.c +@@ -956,6 +956,7 @@ static int + sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg) + { + int len = DEFAULT_SGIO_LEN; ++ int rlen; + + if (fd < 0) { + errno = EBADF; +@@ -963,12 +964,11 @@ sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg) + } + retry: + if (0 == do_inq(fd, 0, 1, pg, buff, len)) { +- len = get_unaligned_be16(&buff[2]) + 4; +- if (len >= maxlen) +- return len; +- if (len > DEFAULT_SGIO_LEN) +- goto retry; +- return len; ++ rlen = get_unaligned_be16(&buff[2]) + 4; ++ if (rlen <= len || len >= maxlen) ++ return rlen; ++ len = (rlen < maxlen)? rlen : maxlen; ++ goto retry; + } + return -1; + } +-- +1.8.3.1 + + diff --git a/multipath-tools.spec b/multipath-tools.spec index 56cbd9d170326fdccc11d5ef2daf89c4f9fe71b7..139d7c2d3b00f1d9387c89410853dfbd7a6e3061 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -1,6 +1,6 @@ Name: multipath-tools Version: 0.7.7 -Release: 17 +Release: 18 Summary: Tools to manage multipath devices with the device-mapper License: GPLv2-or-later and LGPLv2+ URL: http://christophe.varoqui.free.fr/ @@ -68,6 +68,8 @@ Patch6025: 6025-libmultipath-fix-another-WWID-overflow-in-parse_vpd_.patch Patch6026: 6026-libmultipath-fix-possible-WWID-overflow-in-parse_vpd.patch Patch6027: 6027-libmultipath-fix-parsing-of-SCSI-name-string-iqn-for.patch Patch6028: 6028-libmultipath-fix-double-free-in-pgpolicyfn-error-pat.patch +Patch6029: 6029-libmultipath-fix-files-read-from-config_dir.patch +Patch6030: 6030-libmultipath-fix-sgio_get_vpd-looping.patch BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 @@ -209,6 +211,12 @@ fi %changelog +* Sat May 28 2020 ethan848 - 0.7.7-18 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:backport bugfix from community + * Thu Mar 19 2020 hy-euler - 0.7.7-17 - Type:enhancement - ID:NA