blob: 5a3fd8374ba7b690703000d794e06ff53ec7a1ac [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Benjamin Marzinski <bmarzins@redhat.com>
3Date: Tue, 5 Jun 2018 15:31:55 -0500
4Subject: [PATCH] multipath: don't check timestamps without a path
5
6If a path was blacklisted, pathvec could exist but have no path in it.
7print_cmd_valid wasn't checking this before calling
8find_multipaths_check_timeout(). This was causing it to dereference a
9NULL pointer in these cases.
10
11Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
12---
13 multipath/main.c | 4 +---
14 1 file changed, 1 insertion(+), 3 deletions(-)
15
16diff --git a/multipath/main.c b/multipath/main.c
17index c69e996..3f0a6aa 100644
18--- a/multipath/main.c
19+++ b/multipath/main.c
20@@ -482,10 +482,8 @@ static int print_cmd_valid(int k, const vector pathvec,
21 pp, pp->find_multipaths_timeout, &until);
22 if (wait != FIND_MULTIPATHS_WAITING)
23 k = 1;
24- } else if (pathvec != NULL) {
25- pp = VECTOR_SLOT(pathvec, 0);
26+ } else if (pathvec != NULL && (pp = VECTOR_SLOT(pathvec, 0)))
27 wait = find_multipaths_check_timeout(pp, 0, &until);
28- }
29 if (wait == FIND_MULTIPATHS_WAITING)
30 printf("FIND_MULTIPATHS_WAIT_UNTIL=\"%ld.%06ld\"\n",
31 until.tv_sec, until.tv_nsec/1000);
32--
332.7.4
34