Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> |
| 3 | Date: Tue, 5 Jun 2018 15:31:55 -0500 |
| 4 | Subject: [PATCH] multipath: don't check timestamps without a path |
| 5 | |
| 6 | If a path was blacklisted, pathvec could exist but have no path in it. |
| 7 | print_cmd_valid wasn't checking this before calling |
| 8 | find_multipaths_check_timeout(). This was causing it to dereference a |
| 9 | NULL pointer in these cases. |
| 10 | |
| 11 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> |
| 12 | --- |
| 13 | multipath/main.c | 4 +--- |
| 14 | 1 file changed, 1 insertion(+), 3 deletions(-) |
| 15 | |
| 16 | diff --git a/multipath/main.c b/multipath/main.c |
| 17 | index 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 | -- |
| 33 | 2.7.4 |
| 34 | |