multipath: don't check timestamps without a path
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 5 Jun 2018 22:40:21 +0000 (17:40 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 21 Jun 2018 07:37:13 +0000 (09:37 +0200)
If a path was blacklisted, pathvec could exist but have no path in it.
print_cmd_valid wasn't checking this before calling
find_multipaths_check_timeout(). This was causing it to dereference a
NULL pointer in these cases.

Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipath/main.c

index c69e996..3f0a6aa 100644 (file)
@@ -482,10 +482,8 @@ static int print_cmd_valid(int k, const vector pathvec,
                        pp, pp->find_multipaths_timeout, &until);
                if (wait != FIND_MULTIPATHS_WAITING)
                        k = 1;
-       } else if (pathvec != NULL) {
-               pp = VECTOR_SLOT(pathvec, 0);
+       } else if (pathvec != NULL && (pp = VECTOR_SLOT(pathvec, 0)))
                wait = find_multipaths_check_timeout(pp, 0, &until);
-       }
        if (wait == FIND_MULTIPATHS_WAITING)
                printf("FIND_MULTIPATHS_WAIT_UNTIL=\"%ld.%06ld\"\n",
                               until.tv_sec, until.tv_nsec/1000);