diff mbox series

[2/6] multipathd: check for NULL udevice in cli_add_path

Message ID 1539194473-6243-3-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series More Misc Multipath patches | expand

Commit Message

Benjamin Marzinski Oct. 10, 2018, 6:01 p.m. UTC
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 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Martin Wilck Oct. 10, 2018, 6:13 p.m. UTC | #1
On Wed, 2018-10-10 at 13:01 -0500, Benjamin Marzinski wrote:
> 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>


Reviewed-by: Martin Wilck <mwilck@suse.com>
diff mbox series

Patch

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,