All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions
@ 2024-11-21  0:17 Benjamin Marzinski
  2024-11-21 17:05 ` Martin Wilck
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Marzinski @ 2024-11-21  0:17 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: device-mapper development, Martin Wilck

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 --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;
 	}
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions
  2024-11-21  0:17 [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions Benjamin Marzinski
@ 2024-11-21 17:05 ` Martin Wilck
  2024-11-21 18:46   ` Benjamin Marzinski
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wilck @ 2024-11-21 17:05 UTC (permalink / raw)
  To: Benjamin Marzinski, Christophe Varoqui; +Cc: device-mapper development

On Wed, 2024-11-20 at 19:17 -0500, Benjamin Marzinski wrote:
> 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>

Ouch. Thanks!!
Reviewed-by: Martin Wilck <mwilck@suse.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions
  2024-11-21 17:05 ` Martin Wilck
@ 2024-11-21 18:46   ` Benjamin Marzinski
  2024-11-21 18:51     ` Benjamin Marzinski
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Marzinski @ 2024-11-21 18:46 UTC (permalink / raw)
  To: Martin Wilck; +Cc: Christophe Varoqui, device-mapper development

On Thu, Nov 21, 2024 at 06:05:48PM +0100, Martin Wilck wrote:
> On Wed, 2024-11-20 at 19:17 -0500, Benjamin Marzinski wrote:
> > 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>
> 
> Ouch. Thanks!!
> Reviewed-by: Martin Wilck <mwilck@suse.com>

So, in theory the next step would be to open a PR for the upstream
stable branch, if that existed, right?

-Ben


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions
  2024-11-21 18:46   ` Benjamin Marzinski
@ 2024-11-21 18:51     ` Benjamin Marzinski
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Marzinski @ 2024-11-21 18:51 UTC (permalink / raw)
  To: Martin Wilck; +Cc: Christophe Varoqui, device-mapper development

On Thu, Nov 21, 2024 at 01:46:17PM -0500, Benjamin Marzinski wrote:
> On Thu, Nov 21, 2024 at 06:05:48PM +0100, Martin Wilck wrote:
> > On Wed, 2024-11-20 at 19:17 -0500, Benjamin Marzinski wrote:
> > > 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>
> > 
> > Ouch. Thanks!!
> > Reviewed-by: Martin Wilck <mwilck@suse.com>
> 
> So, in theory the next step would be to open a PR for the upstream
> stable branch, if that existed, right?

But I suppose the better actual plan here is just to update the 0.11.0
PR.

> 
> -Ben


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-21 18:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21  0:17 [PATCH] libmultipath: Fix MAPINFO_CHECK_UUID with partitions Benjamin Marzinski
2024-11-21 17:05 ` Martin Wilck
2024-11-21 18:46   ` Benjamin Marzinski
2024-11-21 18:51     ` Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.