multipathd: check for NULL udevice in cli_add_path
authorBenjamin Marzinski <bmarzins@redhat.com>
Wed, 10 Oct 2018 18:01:09 +0000 (13:01 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 12 Oct 2018 07:37:39 +0000 (09:37 +0200)
If cli_add_path can't get a udevice for the path, it should fail
immediately, instead of continuing with a NULL udevice, since it will
fail in store_pathinfo() anyway.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/cli_handlers.c

index bb16472..7500080 100644 (file)
@@ -720,6 +720,10 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
                udevice = udev_device_new_from_subsystem_sysname(udev,
                                                                 "block",
                                                                 param);
+               if (!udevice) {
+                       condlog(0, "%s: can't find path", param);
+                       return 1;
+               }
                conf = get_multipath_config();
                pthread_cleanup_push(put_multipath_config, conf);
                r = store_pathinfo(vecs->pathvec, conf,