Skip to content

Commit

Permalink
ecryptfs: use after free
Browse files Browse the repository at this point in the history
The "full_alg_name" variable is used on a couple error paths, so we
shouldn't free it until the end.

Signed-off-by: Dan Carpenter <[email protected]>
Cc: [email protected]
Signed-off-by: Tyler Hicks <[email protected]>
  • Loading branch information
error27 authored and Tyler Hicks committed Jan 20, 2010
1 parent 4aa25bc commit ece550f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ecryptfs/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
char *cipher_name, size_t *key_size)
{
char dummy_key[ECRYPTFS_MAX_KEY_BYTES];
char *full_alg_name;
char *full_alg_name = NULL;
int rc;

*key_tfm = NULL;
Expand All @@ -1763,7 +1763,6 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
if (rc)
goto out;
*key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC);
kfree(full_alg_name);
if (IS_ERR(*key_tfm)) {
rc = PTR_ERR(*key_tfm);
printk(KERN_ERR "Unable to allocate crypto cipher with name "
Expand All @@ -1786,6 +1785,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
goto out;
}
out:
kfree(full_alg_name);
return rc;
}

Expand Down

0 comments on commit ece550f

Please sign in to comment.