f97259d84a
Rename files * Previous patch 0006-0014 are now patches 0008-0016 Add 0006-multipathd-avoid-null-pointer-dereference-in-LOG_MSG.patch Add 0007-multipath-blacklist-zram-devices.patch * The above 2 patches have been submitted upstream Resolves: bz #1672761
55 lines
1.9 KiB
Diff
55 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Wed, 6 Feb 2019 12:01:32 -0600
|
|
Subject: [PATCH] multipathd: avoid null pointer dereference in LOG_MSG
|
|
|
|
LOG_MSG() will dereference pp->mpp. Commit cb5ec664 added a call to
|
|
LOG_MSG() before the check for (!pp->mpp) in check_path. This can cause
|
|
multipathd to crash. LOG_MSG() should only be called if pp->mpp is set
|
|
and a checker is selected.
|
|
|
|
Also, checker_message() should fail to a generic message if c->cls isn't
|
|
set (which means that a checker hasn't been selected).
|
|
|
|
Fixes: cb5ec664 (multipathd: check_path: improve logging for "unusable
|
|
path" case)
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/checkers.c | 2 +-
|
|
multipathd/main.c | 6 ++++--
|
|
2 files changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
|
|
index 848c4c3..ca95cae 100644
|
|
--- a/libmultipath/checkers.c
|
|
+++ b/libmultipath/checkers.c
|
|
@@ -295,7 +295,7 @@ const char *checker_message(const struct checker *c)
|
|
{
|
|
int id;
|
|
|
|
- if (!c || c->msgid < 0 ||
|
|
+ if (!c || !c->cls || c->msgid < 0 ||
|
|
(c->msgid >= CHECKER_GENERIC_MSGTABLE_SIZE &&
|
|
c->msgid < CHECKER_FIRST_MSGID))
|
|
goto bad_id;
|
|
diff --git a/multipathd/main.c b/multipathd/main.c
|
|
index 0e3ac2c..1caa40f 100644
|
|
--- a/multipathd/main.c
|
|
+++ b/multipathd/main.c
|
|
@@ -2017,8 +2017,10 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
|
|
}
|
|
|
|
if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
|
|
- condlog(2, "%s: unusable path - checker failed", pp->dev);
|
|
- LOG_MSG(2, verbosity, pp);
|
|
+ condlog(2, "%s: unusable path (%s) - checker failed", pp->dev,
|
|
+ checker_state_name(newstate));
|
|
+ if (pp->mpp && checker_selected(&pp->checker))
|
|
+ LOG_MSG(2, verbosity, pp);
|
|
conf = get_multipath_config();
|
|
pthread_cleanup_push(put_multipath_config, conf);
|
|
pathinfo(pp, conf, 0);
|
|
--
|
|
2.17.2
|
|
|