LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH][SELINUX] Fix error handling in selinuxfs
@ 2004-05-17 14:33 Stephen Smalley
  0 siblings, 0 replies; only message in thread
From: Stephen Smalley @ 2004-05-17 14:33 UTC (permalink / raw)
  To: Andrew Morton, James Morris, lkml, Karl MacMillan

Hi,

This patch against 2.6.6 fixes error handling for two out-of-memory
conditions in selinuxfs, avoiding potential deadlock due to returning
without releasing a semaphore.  The patch was submitted by Karl
MacMillan of Tresys.  Please apply.

 security/selinux/selinuxfs.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Index: linux-2.6/security/selinux/selinuxfs.c
===================================================================
RCS file: /nfshome/pal/CVS/linux-2.6/security/selinux/selinuxfs.c,v
retrieving revision 1.43
diff -u -r1.43 selinuxfs.c
--- linux-2.6/security/selinux/selinuxfs.c	20 Apr 2004 15:40:22 -0000	1.43
+++ linux-2.6/security/selinux/selinuxfs.c	17 May 2004 14:11:03 -0000
@@ -833,8 +833,10 @@
 		goto out;
 	}
 	page = (char*)__get_free_page(GFP_KERNEL);
-	if (!page)
-		return -ENOMEM;
+	if (!page) {
+		length = -ENOMEM;
+		goto out;
+	}
 	memset(page, 0, PAGE_SIZE);
 
 	if (copy_from_user(page, buf, count))
@@ -889,8 +891,10 @@
 		goto out;
 	}
 	page = (char*)__get_free_page(GFP_KERNEL);
-	if (!page)
-		return -ENOMEM;
+	if (!page) {
+		length = -ENOMEM;
+		goto out;
+	}
 
 	memset(page, 0, PAGE_SIZE);
 


-- 
Stephen Smalley <sds@epoch.ncsc.mil>
National Security Agency


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

only message in thread, other threads:[~2004-05-17 14:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 14:33 [PATCH][SELINUX] Fix error handling in selinuxfs Stephen Smalley

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