lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240529153835.14994-1-jarkko@kernel.org>
Date: Wed, 29 May 2024 18:38:34 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: linux-integrity@...r.kernel.org,
	keyrings@...r.kernel.org,
	Andreas.Fuchs@...ineon.com,
	James Prestwood <prestwoj@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Eric Biggers <ebiggers@...nel.org>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	linux-crypto@...r.kernel.org,
	Stefan Berger <stefanb@...ux.ibm.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jarkko Sakkinen <jarkko@...nel.org>,
	Peter Huewe <peterhuewe@....de>,
	Jason Gunthorpe <jgg@...pe.ca>,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	Mimi Zohar <zohar@...ux.ibm.com>,
	David Howells <dhowells@...hat.com>,
	Paul Moore <paul@...l-moore.com>,
	James Morris <jmorris@...ei.org>,
	"Serge E. Hallyn" <serge@...lyn.com>,
	Ard Biesheuvel <ardb@...nel.org>,
	linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org
Subject: [PATCH] tpm: Remove illict WARN's from tpm2-sessions.c

Sprinkling all over the place is just plain wrong so drop all of them
before the TPM bus encryption feature hits a release.

Link: https://lore.kernel.org/lkml/20240414170850.148122-1-elder@linaro.org/
Fixes: 1085b8276bb4 ("tpm: Add the rest of the session HMAC API")
Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
---
I have had to literally fight for so many other cosmetic things such as
https://lore.kernel.org/linux-integrity/20240528095438.1857-1-jarkko@kernel.org/T/#u
so that I must have missed this. 

If I contribute to any subsystem, I just plain do all that is asked,
no questions asked. Only reason I left a review unaddressed is when
I see some intersection with the architecture.

And lastly, not introducing new WARN's should be dead obvious, unless
per-WARN explicitly reasoned in the commit message near to the level
that it could be proven at court. Unless this care, I will simply not
review patch with something like this embedded.
---
 drivers/char/tpm/tpm2-sessions.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index 907ac9956a78..371cf28a2b6a 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -394,7 +394,7 @@ void tpm_buf_append_hmac_session(struct tpm_chip *chip, struct tpm_buf *buf,
 		/* we're not the first session */
 		len = get_unaligned_be32(&buf->data[auth->session]);
 		if (4 + len + auth->session != tpm_buf_length(buf)) {
-			WARN(1, "session length mismatch, cannot append");
+			pr_warn("tpm: session length mismatch, cannot append");
 			return;
 		}
 
@@ -644,8 +644,10 @@ void tpm_buf_append_name(struct tpm_chip *chip, struct tpm_buf *buf,
 		dev_err(&chip->dev, "TPM: too many handles\n");
 		return;
 	}
-	WARN(auth->session != tpm_buf_length(buf),
-	     "name added in wrong place\n");
+	if (auth->session != tpm_buf_length(buf)) {
+		pr_warn("tpm: name added in wrong place\n");
+		return;
+	}
 	tpm_buf_append_u32(buf, handle);
 	auth->session += 4;
 
@@ -706,8 +708,8 @@ int tpm_buf_check_hmac_response(struct tpm_chip *chip, struct tpm_buf *buf,
 	int parm_len, len, i, handles;
 
 	if (auth->session >= TPM_HEADER_SIZE) {
-		WARN(1, "tpm session not filled correctly\n");
-		goto out;
+		pr_warn("tpm session not filled correctly\n");
+		return;
 	}
 
 	if (rc != 0)
-- 
2.45.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ