EcryptFS development
 help / color / mirror / Atom feed
* [PATCH v3 1/2] ecryptfs: reject short encrypted key payloads
@ 2026-10-16 17:06 Adriano Cordova
  2026-10-16 17:06 ` [PATCH v3 2/2] ecryptfs: bound session_key_encryption_key_bytes in auth tok Adriano Cordova
  0 siblings, 1 reply; 2+ messages in thread
From: Adriano Cordova @ 2026-10-16 17:06 UTC (permalink / raw)
  To: Tyler Hicks
  Cc: Nguyen Duy Nhat Anh, ecryptfs, linux-kernel, Adriano Cordova,
	stable

Reject payloads too short to hold a struct ecryptfs_auth_tok,
as a key created with a non-ecryptfs format is shorter than
the struct, so the payload gets dereferenced past its end.

Fixes: 1252cc3b232e ("eCryptfs: added support for the encrypted key type")
Cc: <stable@vger.kernel.org>
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
---
Changes in v3:
- Split the v2 patch.
- Remove Nguyen Duy Nhat Anh change and its Reported-by tag.

Changes in v2:
- Add Reported-by tag.

 fs/ecryptfs/ecryptfs_kernel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 58165928ed1e..d4fef71738b0 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -88,6 +88,9 @@ ecryptfs_get_encrypted_key_payload_data(struct key *key)
 	if (!payload)
 		return ERR_PTR(-EKEYREVOKED);
 
+	if (payload->payload_datalen < sizeof(struct ecryptfs_auth_tok))
+		return ERR_PTR(-EINVAL);
+
 	return (struct ecryptfs_auth_tok *)payload->payload_data;
 }
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-16 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 17:06 [PATCH v3 1/2] ecryptfs: reject short encrypted key payloads Adriano Cordova
2026-10-16 17:06 ` [PATCH v3 2/2] ecryptfs: bound session_key_encryption_key_bytes in auth tok Adriano Cordova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox