ecryptfs: Fix memory leakage in keystore.c
PATCH 1/1 ecryptfs: Fix memory leakage in keystore.c
In 'decrypt_pki_encrypted_session_key' function:
Initializes 'payload' pointer and releases it on exit.
--- fs/ecryptfs/keystore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ecryptfs/keystore.c +2 -1
@@ -1149,7 +1149,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,struct ecryptfs_msg_ctx *msg_ctx;struct ecryptfs_message *msg =NULL ;char *auth_tok_sig; -char *payload; +char *payload =NULL ;size_t payload_len =0 ;int rc;
@@ -1203,6 +1203,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, } out:kfree (msg); +kfree (payload);return rc; }
Signature · 1 line
1.8.4
Quoted 6 lines · Geyslan G. Bem
In '
decrypt_pki_encrypted_session_key' function:Initializes 'payload' pointer and releases it on exit.
Signed-off-by Geyslan G. Bem <[email protected]>---
Thanks! This one was easy to verify by auditing the code, but I was also able to verify the leak with kmemleak.
I've targeted it for stable and pushed it to the eCryptfs next branch.
Tyler
Quoted 27 lines
fs/ecryptfs/keystore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/ecryptfs/keystore.c +2
-1@@ -1149,7 +1149,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,struct ecryptfs_msg_ctx *msg_ctx;struct ecryptfs_message *msg =NULL ;char *auth_tok_sig; -char *payload; +char *payload =NULL ;size_t payload_len =0 ;int rc;@@ -1203,6 +1203,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, } out:kfree (msg); +kfree (payload);return rc; }Signature · 1 line
1.8.4
2013/10/16 Tyler Hicks <[email protected]>:
Quoted 10 lines · Geyslan G. Bem
Quoted 6 lines
In '
decrypt_pki_encrypted_session_key' function:Initializes 'payload' pointer and releases it on exit.
Signed-off-by Geyslan G. Bem <[email protected]>---
Thanks! This one was easy to verify by auditing the code, but I was also able to verify the leak with kmemleak.
It's a pleasure.
Quoted 3 lines
I've targeted it for stable and pushed it to the eCryptfs next branch.
Thank you.
Quoted 29 lines
Tyler
Quoted 27 lines
fs/ecryptfs/keystore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/ecryptfs/keystore.c +2
-2@@ -1149,7 +1149,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,struct ecryptfs_msg_ctx *msg_ctx;struct ecryptfs_message *msg =NULL ;char *auth_tok_sig; -char *payload; +char *payload =NULL ;size_t payload_len =0 ;int rc;@@ -1203,6 +1203,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, } out:kfree (msg); +kfree (payload);return rc; } --1.8.4