From: Martin Wilck <mwilck@xxxxxxxx> If check_alias_settings() returns error, the bindings file is inconsistent and proceeding is potentially dangerous. Abort. Found by coverity. Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- multipath/main.c | 5 ++++- multipathd/main.c | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/multipath/main.c b/multipath/main.c index cd234ac..2a42748 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -958,7 +958,10 @@ main (int argc, char *argv[]) exit(RTVL_FAIL); } - check_alias_settings(conf); + if (check_alias_settings(conf)) { + fprintf(stderr, "fatal configuration error, aborting"); + exit(RTVL_FAIL); + } if (optind < argc) { dev = calloc(1, FILE_NAME_SIZE); diff --git a/multipathd/main.c b/multipathd/main.c index 4c7bcf2..1be42c5 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2819,7 +2819,9 @@ reconfigure (struct vectors * vecs) reset_checker_classes(); if (bindings_read_only) conf->bindings_read_only = bindings_read_only; - check_alias_settings(conf); + + if (check_alias_settings(conf)) + return 1; uxsock_timeout = conf->uxsock_timeout; @@ -3332,15 +3334,22 @@ child (__attribute__((unused)) void *param) if (state == DAEMON_SHUTDOWN) break; if (state == DAEMON_CONFIGURE) { + int rc = 0; + pthread_cleanup_push(cleanup_lock, &vecs->lock); lock(&vecs->lock); pthread_testcancel(); if (!need_to_delay_reconfig(vecs)) - reconfigure(vecs); + rc = reconfigure(vecs); else enable_delayed_reconfig(); lock_cleanup_pop(vecs->lock); - post_config_state(DAEMON_IDLE); + if (!rc) + post_config_state(DAEMON_IDLE); + else { + condlog(0, "fatal error applying configuration - aborting"); + exit_daemon(); + } } } -- 2.33.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel