Skip to contentSkip to conversation

nvmet-auth: fix some minor bugs

PATCH Applied Maurizio Lombardi 4 participants 8 messages Apr 10, 2024 – Apr 16, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover nvmet-auth: fix some minor bugs

First patch modifies nvmet_auth_host_hash() so it correctly returns the error code to its caller.

The second patch replaces a pr_debug() with pr_err().

Maurizio Lombardi (2):
nvmet-auth: return the error code to the nvmet_auth_host_hash()
callers
nvmet-auth: replace pr_debug() with pr_err() to report an error.

 drivers/nvme/target/auth.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.3
#1 lore raw

PATCH 1/2 nvmet-auth: return the error code to the nvmet_auth_host_hash() callers

If the nvmet_auth_host_hash() function fails, the error code should be returned to its callers.

---
 drivers/nvme/target/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/auth.c +1 -1
index 3ddbc3880cac..9e51c064b072 100644
@@ -370,7 +370,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
 	nvme_auth_free_key(transformed_key);
 out_free_tfm:
 	crypto_free_shash(shash_tfm);
-	return 0;
+	return ret;
 }
 
 int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
Signature · 1 line
2.39.3
#4 lore raw

PATCH 2/2 nvmet-auth: replace pr_debug() with pr_err() to report an error.

In reply to Maurizio Lombardi

In nvmet_auth_host_hash(), if a mismatch is detected in the hash length the kernel should print an error.

---
 drivers/nvme/target/auth.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/auth.c +3 -3
index 9e51c064b072..fb518b00f71f 100644
@@ -285,9 +285,9 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
 	}
 
 	if (shash_len != crypto_shash_digestsize(shash_tfm)) {
-		pr_debug("%s: hash len mismatch (len %d digest %d)\n",
-			 __func__, shash_len,
-			 crypto_shash_digestsize(shash_tfm));
+		pr_err("%s: hash len mismatch (len %d digest %d)\n",
+			__func__, shash_len,
+			crypto_shash_digestsize(shash_tfm));
 		ret = -EINVAL;
 		goto out_free_tfm;
 	}
Signature · 1 line
2.39.3
Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] nvmet-auth: replace pr_debug() with pr_err() to report an error.

In reply to Maurizio Lombardi
Quoted 7 lines · Maurizio Lombardi

In nvmet_auth_host_hash(), if a mismatch is detected in the hash length the kernel should print an error.

---
  drivers/nvme/target/auth.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Looks good.

-ck

maintainer Applied
#7 lore raw
In reply to Maurizio Lombardi
Quoted 4 lines · Maurizio Lombardi

First patch modifies nvmet_auth_host_hash() so it correctly returns the error code to its caller.

The second patch replaces a pr_debug() with pr_err().

Thanks, applied to nvme-6.9.