linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ecryptfs: initialize new auth_tokens before teardown
@ 2007-12-11 23:52 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2007-12-11 23:52 UTC (permalink / raw)
  To: linux-kernel Mailing List; +Cc: Andrew Morton, Michael Halcrow

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>

---

Index: linux/fs/ecryptfs/keystore.c
===================================================================
--- linux.orig/fs/ecryptfs/keystore.c
+++ linux/fs/ecryptfs/keystore.c
@@ -1851,7 +1851,7 @@ ecryptfs_add_global_auth_tok(struct ecry
 	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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-11 23:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11 23:52 [PATCH] ecryptfs: initialize new auth_tokens before teardown Eric Sandeen

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).