aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-03-12 12:17:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-14 18:27:48 -0400
commit04ff97086b1a3237bbd1fe6390fa80fe75207e23 (patch)
tree877e26055759d84a726c6bc68245bc6f9a4a5753 /security
parentc4823bce033be74c0fcfbcae2f1be0854fdc2e18 (diff)
[PATCH] sanitize security_getprocattr() API
have it return the buffer it had allocated Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/dummy.c2
-rw-r--r--security/selinux/hooks.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/security/dummy.c b/security/dummy.c
index 558795b237d6..8ffd76405b5b 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -907,7 +907,7 @@ static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
907 return; 907 return;
908} 908}
909 909
910static int dummy_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 910static int dummy_getprocattr(struct task_struct *p, char *name, char **value)
911{ 911{
912 return -EINVAL; 912 return -EINVAL;
913} 913}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 19a385e9968e..d41e24d6ae41 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4468,11 +4468,12 @@ static void selinux_d_instantiate (struct dentry *dentry, struct inode *inode)
4468} 4468}
4469 4469
4470static int selinux_getprocattr(struct task_struct *p, 4470static int selinux_getprocattr(struct task_struct *p,
4471 char *name, void *value, size_t size) 4471 char *name, char **value)
4472{ 4472{
4473 struct task_security_struct *tsec; 4473 struct task_security_struct *tsec;
4474 u32 sid; 4474 u32 sid;
4475 int error; 4475 int error;
4476 unsigned len;
4476 4477
4477 if (current != p) { 4478 if (current != p) {
4478 error = task_has_perm(current, p, PROCESS__GETATTR); 4479 error = task_has_perm(current, p, PROCESS__GETATTR);
@@ -4500,7 +4501,10 @@ static int selinux_getprocattr(struct task_struct *p,
4500 if (!sid) 4501 if (!sid)
4501 return 0; 4502 return 0;
4502 4503
4503 return selinux_getsecurity(sid, value, size); 4504 error = security_sid_to_context(sid, value, &len);
4505 if (error)
4506 return error;
4507 return len;
4504} 4508}
4505 4509
4506static int selinux_setprocattr(struct task_struct *p, 4510static int selinux_setprocattr(struct task_struct *p,