Commit cfeff004 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 5187778f
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment