Skip to content

Commit

Permalink
ecryptfs: initialize new auth_tokens before teardown
Browse files Browse the repository at this point in the history
ecryptfs_destroy_mount_crypt_stat() checks whether each
auth_tok->global_auth_tok_key is nonzero and if so puts that key.  However,
in some early mount error paths nothing has initialized the pointer, and we
try to key_put() garbage.  Running the bad cipher tests in the testsuite
exposes this, and it's happy with the following change.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Dec 18, 2007
1 parent 60af880 commit 459e216
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ecryptfs/keystore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
struct ecryptfs_global_auth_tok *new_auth_tok;
int rc = 0;

new_auth_tok = kmem_cache_alloc(ecryptfs_global_auth_tok_cache,
new_auth_tok = kmem_cache_zalloc(ecryptfs_global_auth_tok_cache,
GFP_KERNEL);
if (!new_auth_tok) {
rc = -ENOMEM;
Expand Down

0 comments on commit 459e216

Please sign in to comment.