diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 51651314b7a6..bd3e025899f7 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -737,6 +737,12 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, "password tokens\n", __func__); goto out_free_unlock; } + if (s->auth_tok->token.password.session_key_encryption_key_bytes > + sizeof(s->auth_tok->token.password.session_key_encryption_key)) { + printk(KERN_ERR "Error FNEK key size too large\n"); + rc = -EINVAL; + goto out_free_unlock; + } md5(s->auth_tok->token.password.session_key_encryption_key, s->auth_tok->token.password.session_key_encryption_key_bytes,