Blame SOURCES/0031-libmultipath-fix-sysfs-dev_loss_tmo-parsing.patch

785c99
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
785c99
From: Benjamin Marzinski <bmarzins@redhat.com>
785c99
Date: Thu, 25 Jun 2020 20:46:08 -0500
785c99
Subject: [PATCH] libmultipath: fix sysfs dev_loss_tmo parsing
785c99
785c99
dev_loss_tmo is a u32 value. However the kernel sysfs code prints it as
785c99
a signed integer. This means that if dev_loss_tmo is above INT_MAX, the
785c99
sysfs value will be a negative number. Parsing this was causing
785c99
sysfs_set_rport_tmo() to fail.
785c99
785c99
Signed-off-by: Martin Wilck <mwilck@suse.com>
785c99
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
785c99
---
785c99
 libmultipath/discovery.c | 6 +++---
785c99
 1 file changed, 3 insertions(+), 3 deletions(-)
785c99
785c99
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
785c99
index ffec5162..83a41a4a 100644
785c99
--- a/libmultipath/discovery.c
785c99
+++ b/libmultipath/discovery.c
785c99
@@ -583,7 +583,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
785c99
 	struct udev_device *rport_dev = NULL;
785c99
 	char value[16], *eptr;
785c99
 	char rport_id[32];
785c99
-	unsigned long long tmo = 0;
785c99
+	unsigned int tmo;
785c99
 	int ret;
785c99
 
785c99
 	sprintf(rport_id, "rport-%d:%d-%d",
785c99
@@ -607,8 +607,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
785c99
 			"error %d", rport_id, -ret);
785c99
 		goto out;
785c99
 	}
785c99
-	tmo = strtoull(value, &eptr, 0);
785c99
-	if (value == eptr || tmo == ULLONG_MAX) {
785c99
+	tmo = strtoul(value, &eptr, 0);
785c99
+	if (value == eptr) {
785c99
 		condlog(0, "%s: Cannot parse dev_loss_tmo "
785c99
 			"attribute '%s'", rport_id, value);
785c99
 		goto out;
785c99
-- 
785c99
2.17.2
785c99