]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
selinux check return of kmalloc
authorChris Wright <chrisw@sous-sol.org>
Tue, 16 May 2006 23:47:13 +0000 (16:47 -0700)
committerChris Wright <chrisw@sous-sol.org>
Tue, 16 May 2006 23:47:13 +0000 (16:47 -0700)
queue-2.6.16/selinux-check-for-failed-kmalloc-in-security_sid_to_context.patch [new file with mode: 0644]
queue-2.6.16/series

diff --git a/queue-2.6.16/selinux-check-for-failed-kmalloc-in-security_sid_to_context.patch b/queue-2.6.16/selinux-check-for-failed-kmalloc-in-security_sid_to_context.patch
new file mode 100644 (file)
index 0000000..037b633
--- /dev/null
@@ -0,0 +1,31 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: Serge E. Hallyn <serue@us.ibm.com>
+Date: Mon, 15 May 2006 09:43:48 -0700
+Subject: [PATCH] selinux: check for failed kmalloc in security_sid_to_context()
+
+Check for NULL kmalloc return value before writing to it.
+
+Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
+Acked-by: James Morris <jmorris@namei.org>
+Cc: Stephen Smalley <sds@tycho.nsa.gov>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+
+ security/selinux/ss/services.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- linux-2.6.16.16.orig/security/selinux/ss/services.c
++++ linux-2.6.16.16/security/selinux/ss/services.c
+@@ -592,6 +592,10 @@ int security_sid_to_context(u32 sid, cha
+                       *scontext_len = strlen(initial_sid_to_string[sid]) + 1;
+                       scontextp = kmalloc(*scontext_len,GFP_ATOMIC);
++                      if (!scontextp) {
++                              rc = -ENOMEM;
++                              goto out;
++                      }
+                       strcpy(scontextp, initial_sid_to_string[sid]);
+                       *scontext = scontextp;
+                       goto out;
index 71aac5cdd17974d51d07c91ea7317d55915bacb0..8df69f08e083e5272ea2d692f5f0dfea4e04a56c 100644 (file)
@@ -8,3 +8,4 @@ smbus-unhiding-kills-thermal-management.patch
 scx200_acb-fix-resource-name-use-after-free.patch
 netfilter-do_add_counters-race-possible-info-leak.patch
 tg3-ethtool-always-report-port-is-tp.patch
+selinux-check-for-failed-kmalloc-in-security_sid_to_context.patch