Skip to content

Commit 24ea1ed

Browse files
luk1337Karan-Frost
authored andcommitted
e2fsck: Loosen fscrypt_policy struct size check
Some OEMs extend this struct in kernel, which leads to e2fsck believing that encryption policy is corrupted. Change-Id: I4385775c69d990efd7e4fd442c23ddc5cba4d0e7
1 parent 007f000 commit 24ea1ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

e2fsck/encrypted_files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static __u32 fscrypt_context_to_policy(const void *xattr, size_t xattr_size,
175175
struct fscrypt_policy_v1 *policy = &policy_u->v1;
176176
const struct fscrypt_context_v1 *ctx = &ctx_u->v1;
177177

178-
if (xattr_size != sizeof(*ctx))
178+
if (xattr_size < sizeof(*ctx))
179179
return CORRUPT_ENCRYPTION_POLICY;
180180
policy->version = ctx->version;
181181
policy->contents_encryption_mode =
@@ -192,7 +192,7 @@ static __u32 fscrypt_context_to_policy(const void *xattr, size_t xattr_size,
192192
struct fscrypt_policy_v2 *policy = &policy_u->v2;
193193
const struct fscrypt_context_v2 *ctx = &ctx_u->v2;
194194

195-
if (xattr_size != sizeof(*ctx))
195+
if (xattr_size < sizeof(*ctx))
196196
return CORRUPT_ENCRYPTION_POLICY;
197197
policy->version = ctx->version;
198198
policy->contents_encryption_mode =

0 commit comments

Comments
 (0)