Skip to contentSkip to conversation

ecryptfs: Validate minimum header extent size

PATCH In review Stephan Müller 2 participants 2 messages Jun 26, 2006 – Jun 27, 2006 Ecrypt file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 ecryptfs: Validate minimum header extent size

Kernel version: 2.6.17-mm1

The encrypted file ecryptfs maintains has in the first page meta data that is needed for ecryptfs operation. As the encrypted file is untrusted, every bit read of that file must be validated.

The patch ensures that crypt_stat->num_header_extents_at_front is checked for improper values.

---

 fs/ecryptfs/crypto.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

1d76f6b4a787047ca354c8385614b0d549db6bc8

fs/ecryptfs/crypto.c +2 -1
index 427f470..91b350e 100644
@@ -1333,7 +1333,8 @@ static int parse_header_metadata(struct 
 	crypt_stat->num_header_extents_at_front =
 		(int)num_header_extents_at_front;
 	(*bytes_read) = 6;
-	if (crypt_stat->header_extent_size
+	if ((crypt_stat->header_extent_size
+	     * crypt_stat->num_header_extents_at_front)
 	    < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) {
 		rc = -EINVAL;
 		ecryptfs_printk(KERN_WARNING, "Invalid header extent size: "
#1 lore raw
Quoted 6 lines · Stephan M?ller

The encrypted file ecryptfs maintains has in the first page meta data that is needed for ecryptfs operation. As the encrypted file is untrusted, every bit read of that file must be validated.

The patch ensures that crypt_stat->num_header_extents_at_front is checked for improper values.

All of Stephan's patches in this set, with my fix on top of #3, look good to me.

Mike