Skip to content

Commit fe2e082

Browse files
wenwenwang1tyhicks
authored andcommitted
ecryptfs: fix a memory leak bug in parse_tag_1_packet()
In parse_tag_1_packet(), if tag 1 packet contains a key larger than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES, no cleanup is executed, leading to a memory leak on the allocated 'auth_tok_list_item'. To fix this issue, go to the label 'out_free' to perform the cleanup work. Cc: [email protected] Fixes: dddfa46 ("[PATCH] eCryptfs: Public key; packet management") Signed-off-by: Wenwen Wang <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
1 parent 5f97cbe commit fe2e082

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ecryptfs/keystore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
13041304
printk(KERN_WARNING "Tag 1 packet contains key larger "
13051305
"than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES\n");
13061306
rc = -EINVAL;
1307-
goto out;
1307+
goto out_free;
13081308
}
13091309
memcpy((*new_auth_tok)->session_key.encrypted_key,
13101310
&data[(*packet_size)], (body_size - (ECRYPTFS_SIG_SIZE + 2)));

0 commit comments

Comments
 (0)