ecryptfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ecryptfs: Fix memory leakage in keystore.c
@ 2013-10-11 19:49 Geyslan G. Bem
  2013-10-17  1:11 ` Tyler Hicks
  0 siblings, 1 reply; 3+ messages in thread
From: Geyslan G. Bem @ 2013-10-11 19:49 UTC (permalink / raw)
  To: tyhicks; +Cc: ecryptfs, linux-kernel, joe, kernel-br, Geyslan G. Bem

In 'decrypt_pki_encrypted_session_key' function:

Initializes 'payload' pointer and releases it on exit.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 fs/ecryptfs/keystore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 7d52806..4725a07 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ecryptfs: Fix memory leakage in keystore.c
  2013-10-11 19:49 [PATCH] ecryptfs: Fix memory leakage in keystore.c Geyslan G. Bem
@ 2013-10-17  1:11 ` Tyler Hicks
  2013-10-17  1:21   ` Geyslan Gregório Bem
  0 siblings, 1 reply; 3+ messages in thread
From: Tyler Hicks @ 2013-10-17  1:11 UTC (permalink / raw)
  To: Geyslan G. Bem; +Cc: ecryptfs, linux-kernel, joe, kernel-br

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

On 2013-10-11 16:49:16, Geyslan G. Bem wrote:
> In 'decrypt_pki_encrypted_session_key' function:
> 
> Initializes 'payload' pointer and releases it on exit.
> 
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---

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

>  fs/ecryptfs/keystore.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
> index 7d52806..4725a07 100644
> --- a/fs/ecryptfs/keystore.c
> +++ b/fs/ecryptfs/keystore.c
> @@ -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
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ecryptfs: Fix memory leakage in keystore.c
  2013-10-17  1:11 ` Tyler Hicks
@ 2013-10-17  1:21   ` Geyslan Gregório Bem
  0 siblings, 0 replies; 3+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-17  1:21 UTC (permalink / raw)
  To: Tyler Hicks; +Cc: ecryptfs, LKML, Joe Perches, kernel-br

2013/10/16 Tyler Hicks <tyhicks@canonical.com>:
> On 2013-10-11 16:49:16, Geyslan G. Bem wrote:
>> In 'decrypt_pki_encrypted_session_key' function:
>>
>> Initializes 'payload' pointer and releases it on exit.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>
> 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.

>
> I've targeted it for stable and pushed it to the eCryptfs next branch.
>
Thank you.

> Tyler
>
>>  fs/ecryptfs/keystore.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
>> index 7d52806..4725a07 100644
>> --- a/fs/ecryptfs/keystore.c
>> +++ b/fs/ecryptfs/keystore.c
>> @@ -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
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-17  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 19:49 [PATCH] ecryptfs: Fix memory leakage in keystore.c Geyslan G. Bem
2013-10-17  1:11 ` Tyler Hicks
2013-10-17  1:21   ` Geyslan Gregório Bem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).