[dm-devel] [PATCH 2/6] multipathd: check for NULL udevice in cli_add_path

Benjamin Marzinski bmarzins at redhat.com
Wed Oct 10 18:01:09 UTC 2018


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 at 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




More information about the dm-devel mailing list