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 <bmarz...@redhat.com>
---
 multipathd/cli_handlers.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index bb16472..7500080 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -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,
-- 
2.7.4

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to