diff mbox series

libmultipath: Fix MAPINFO_CHECK_UUID with partitions

Message ID 20241121001744.699362-1-bmarzins@redhat.com (mailing list archive)
State New
Headers show
Series libmultipath: Fix MAPINFO_CHECK_UUID with partitions | expand

Commit Message

Benjamin Marzinski Nov. 21, 2024, 12:17 a.m. UTC
In libmp_mapinfo__(), if is_mpath_part_uuid() succeeded, instead of
ending the 'if' statement, is_mpath_uuid() would be called because of
the OR operator.  This would always fail if is_mpath_part_uuid() passed.
This meant that libmp_mapinfo__() could never match partitions with
MAPINFO_CHECK_UUID.

Fix that by not calling is_mpath_uuid() if MAPINFO_PART_ONLY is set.

Fixes: c1aa0285 ("libmultipath: make MAPINFO_CHECK_UUID work with partitions")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/devmapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 9714270d..224be512 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -734,7 +734,7 @@  static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma
 
 	if (flags & MAPINFO_CHECK_UUID &&
 	    ((flags & MAPINFO_PART_ONLY && !is_mpath_part_uuid(uuid, NULL)) ||
-	     !is_mpath_uuid(uuid))) {
+	     (!(flags & MAPINFO_PART_ONLY) && !is_mpath_uuid(uuid)))) {
 		condlog(4, "%s: UUID mismatch: %s", fname__, uuid);
 		return DMP_NO_MATCH;
 	}