File 0024-fabrics-fix-infinite-loop-on-invalid-parameters.patch of Package nvme-cli.26590

From: Hannes Reinecke <hare@suse.de>
Date: Wed, 24 Mar 2021 07:39:31 +0100
Subject: fabrics: fix infinite loop on invalid parameters
Git-commit: 81f54310e74f0a82c25a6f8a21316c30f1801299
References: bsc#1200644

When parsing the discovery entries results in invalid parameters
for a given connection we'll enter an infinite loop as the -EINVAL
error code is always assumed to indicate a wrong 'disable_sqflow'
setting.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 fabrics.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fabrics.c
+++ b/fabrics.c
@@ -1239,7 +1239,8 @@ static int connect_ctrl(struct nvmf_disc
 		ret = do_discover(argstr, true);
 	else
 		ret = add_ctrl(argstr);
-	if (ret == -EINVAL && e->treq & NVMF_TREQ_DISABLE_SQFLOW) {
+	if (ret == -EINVAL && disable_sqflow &&
+	    e->treq & NVMF_TREQ_DISABLE_SQFLOW) {
 		/* disable_sqflow param might not be supported, try without it */
 		disable_sqflow = false;
 		goto retry;
openSUSE Build Service is sponsored by