diff mbox series

[1/4] libmultipath: avoid infinite loop with bad vpd page 83 identifier

Message ID 1616719966-10221-2-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series Fixups to my wwid recheck patch | expand

Commit Message

Benjamin Marzinski March 26, 2021, 12:52 a.m. UTC
If a device with a scsi name identifier has an unknown prefix,
parse_vpd_pg83() needs to advance to the next identifier, instead of
simply trying the same one again in an infinite loop.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Wilck March 26, 2021, 4:49 p.m. UTC | #1
On Thu, 2021-03-25 at 19:52 -0500, Benjamin Marzinski wrote:
> If a device with a scsi name identifier has an unknown prefix,
> parse_vpd_pg83() needs to advance to the next identifier, instead of
> simply trying the same one again in an infinite loop.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>

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

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f216a724..5727f7a6 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1157,7 +1157,7 @@  parse_vpd_pg83(const unsigned char *in, size_t in_len,
 			if (memcmp(d + 4, "eui.", 4) &&
 			    memcmp(d + 4, "naa.", 4) &&
 			    memcmp(d + 4, "iqn.", 4))
-				continue;
+				break;
 			if (prio < 4) {
 				prio = 4;
 				vpd = d;