[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20100329140539.GB24478@Krystal>
Date: Mon, 29 Mar 2010 10:05:39 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] cred fix error handling
Causes memory leak on OO mem condition.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
CC: David Howells <dhowells@...hat.com>
---
kernel/cred.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: linux.trees.git/kernel/cred.c
===================================================================
--- linux.trees.git.orig/kernel/cred.c 2010-03-29 09:40:53.000000000 -0400
+++ linux.trees.git/kernel/cred.c 2010-03-29 10:03:15.000000000 -0400
@@ -364,7 +364,7 @@ struct cred *prepare_usermodehelper_cred
new = kmem_cache_alloc(cred_jar, GFP_ATOMIC);
if (!new)
- return NULL;
+ goto free_tgcred;
kdebug("prepare_usermodehelper_creds() alloc %p", new);
@@ -397,6 +397,10 @@ struct cred *prepare_usermodehelper_cred
error:
put_cred(new);
+free_tgcred:
+#ifdef CONFIG_KEYS
+ kfree(tgcred);
+#endif
return NULL;
}
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists