diff mbox series

[1/3] libmultipath: fix disassemble status for historical-service-time PS

Message ID 1642476453-5974-2-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series Misc Multipath fixes | expand

Commit Message

Benjamin Marzinski Jan. 18, 2022, 3:27 a.m. UTC
The historical-service-time path selector prints out 2 path group status
arguments. This is the only path selector that uses the group status
arguments. All the others only have path status arguments.
disassemble_status() was expecting the number of group status arguments
to always be zero, causing it to fail at disassembling the status of
devices that use historical-service-time path selector. Now multipath
actually checks the number of group arguments, and skips them.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/dmparser.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 24ba4ac3..50d13c08 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -436,9 +436,19 @@  int disassemble_status(const char *params, struct multipath *mpp)
 		free(word);
 
 		/*
-		 * PG Status (discarded, would be '0' anyway)
+		 * Path Selector Group Arguments
 		 */
-		p += get_word(p, NULL);
+		p += get_word(p, &word);
+
+		if (!word)
+			return 1;
+
+		num_pg_args = atoi(word);
+		free(word);
+
+		/* Ignore ps group arguments */
+		for (j = 0; j < num_pg_args; j++)
+			p += get_word(p, NULL);
 
 		p += get_word(p, &word);