diff mbox

[4/5] mpath: skip device configs without vendor/product

Message ID 1496372952-27110-5-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Benjamin Marzinski June 2, 2017, 3:09 a.m. UTC
Right now if multipath.conf includes a device configuration without a
vendor or product string, it will automatically be applied to all
devices, skipping all other configs entirely.  This is clearly wrong.
This patch makes sure that user added configs include vendor and
product strings

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/config.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/libmultipath/config.c b/libmultipath/config.c
index bb6619b..6b23601 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -451,6 +451,13 @@  restart:
 			break;
 		j = n;
 		vector_foreach_slot_after(hw, hwe2, j) {
+			/* drop invalid device configs */
+			if (!hwe2->vendor || !hwe2->product) {
+				condlog(0, "device config missing vendor or product parameter");
+				vector_del_slot(hw, j--);
+				free_hwe(hwe2);
+				continue;
+			}
 			if (hwe_regmatch(hwe1, hwe2))
 				continue;
 			/* dup */