diff options
author | Andrew Morton <akpm@osdl.org> | 2004-05-19 02:37:59 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-19 02:37:59 -0700 |
commit | cfeff00490d9b29aa802a0651a1c53fd0ba0771e (patch) | |
tree | 7821cd9b1ebf9c8ff82f7a8bb06ae03ac4ebff15 /security | |
parent | 5187778fe86908d134bd13f18812aba7e218525b (diff) | |
download | history-cfeff00490d9b29aa802a0651a1c53fd0ba0771e.tar.gz |
[PATCH] SELinux: fix error handling in selinuxfs
From: Stephen Smalley <sds@epoch.ncsc.mil>
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.
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/selinuxfs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 1a589da54f1b6e..274275a61f4d61 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -833,8 +833,10 @@ static ssize_t sel_write_bool(struct file *filep, const char *buf, 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 @@ static ssize_t sel_commit_bools_write(struct file *filep, const char *buf, goto out; } page = (char*)__get_free_page(GFP_KERNEL); - if (!page) - return -ENOMEM; + if (!page) { + length = -ENOMEM; + goto out; + } memset(page, 0, PAGE_SIZE); |