A multipath device alias of dm-1 is valid, albeit a really bad idea. Make sure that find_mp_by_str() is only checking for multipath devices by minor number for strings that really are of the form dm-<number>, and if the minor-number check fails, check if the string is an alias, just to be safe. Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- libmultipath/structs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libmultipath/structs.c b/libmultipath/structs.c index e248fb51..d89f2187 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -480,11 +480,12 @@ struct multipath * find_mp_by_str (const struct _vector *mpvec, const char * str) { int minor; - struct multipath *mpp; + char dummy; + struct multipath *mpp = NULL; - if (sscanf(str, "dm-%d", &minor) == 1) + if (sscanf(str, "dm-%d%c", &minor, &dummy) == 1) mpp = find_mp_by_minor(mpvec, minor); - else + if (!mpp) mpp = find_mp_by_alias(mpvec, str); if (!mpp) -- 2.45.0