Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From f88d60a93e98d86ae294f2317a122c4efde276f0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Marzinski <bmarzins@redhat.com> |
| 3 | Date: Wed, 31 May 2017 17:58:59 -0500 |
| 4 | Subject: [PATCH 10/14] mpath: skip device configs without vendor/product |
| 5 | |
| 6 | Right now if multipath.conf includes a device configuration without a |
| 7 | vendor or product string, it will automatically be applied to all |
| 8 | devices, skipping all other configs entirely. This is clearly wrong. |
| 9 | This patch makes sure that user added configs include vendor and |
| 10 | product strings |
| 11 | |
| 12 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> |
| 13 | --- |
| 14 | libmultipath/config.c | 7 +++++++ |
| 15 | 1 file changed, 7 insertions(+) |
| 16 | |
| 17 | diff --git a/libmultipath/config.c b/libmultipath/config.c |
| 18 | index c485748..bdde113 100644 |
| 19 | --- a/libmultipath/config.c |
| 20 | +++ b/libmultipath/config.c |
| 21 | @@ -452,6 +452,13 @@ restart: |
| 22 | break; |
| 23 | j = n; |
| 24 | vector_foreach_slot_after(hw, hwe2, j) { |
| 25 | + /* drop invalid device configs */ |
| 26 | + if (!hwe2->vendor || !hwe2->product) { |
| 27 | + condlog(0, "device config missing vendor or product parameter"); |
| 28 | + vector_del_slot(hw, j--); |
| 29 | + free_hwe(hwe2); |
| 30 | + continue; |
| 31 | + } |
| 32 | if (hwe_regmatch(hwe1, hwe2)) |
| 33 | continue; |
| 34 | /* dup */ |
| 35 | -- |
| 36 | 2.8.1 |
| 37 | |