aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c2
-rw-r--r--security/smack/smack_lsm.c11
-rw-r--r--security/tomoyo/common.c6
-rw-r--r--security/tomoyo/realpath.c16
-rw-r--r--security/tomoyo/tomoyo.c6
5 files changed, 24 insertions, 17 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index ba808ef6babb..2fcad7c33eaf 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3153,7 +3153,7 @@ static int selinux_file_send_sigiotask(struct task_struct *tsk,
3153 struct fown_struct *fown, int signum) 3153 struct fown_struct *fown, int signum)
3154{ 3154{
3155 struct file *file; 3155 struct file *file;
3156 u32 sid = current_sid(); 3156 u32 sid = task_sid(tsk);
3157 u32 perm; 3157 u32 perm;
3158 struct file_security_struct *fsec; 3158 struct file_security_struct *fsec;
3159 3159
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 921514902eca..98b3195347ab 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -609,8 +609,12 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name,
609 strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) { 609 strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {
610 if (!capable(CAP_MAC_ADMIN)) 610 if (!capable(CAP_MAC_ADMIN))
611 rc = -EPERM; 611 rc = -EPERM;
612 /* a label cannot be void and cannot begin with '-' */ 612 /*
613 if (size == 0 || (size > 0 && ((char *)value)[0] == '-')) 613 * check label validity here so import wont fail on
614 * post_setxattr
615 */
616 if (size == 0 || size >= SMK_LABELLEN ||
617 smk_import(value, size) == NULL)
614 rc = -EINVAL; 618 rc = -EINVAL;
615 } else 619 } else
616 rc = cap_inode_setxattr(dentry, name, value, size, flags); 620 rc = cap_inode_setxattr(dentry, name, value, size, flags);
@@ -644,9 +648,6 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name,
644 if (strcmp(name, XATTR_NAME_SMACK)) 648 if (strcmp(name, XATTR_NAME_SMACK))
645 return; 649 return;
646 650
647 if (size >= SMK_LABELLEN)
648 return;
649
650 isp = dentry->d_inode->i_security; 651 isp = dentry->d_inode->i_security;
651 652
652 /* 653 /*
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index d4d41b3efc7c..ddfb9cccf468 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -1720,14 +1720,14 @@ static bool tomoyo_policy_loader_exists(void)
1720 * policies are not loaded yet. 1720 * policies are not loaded yet.
1721 * Thus, let do_execve() call this function everytime. 1721 * Thus, let do_execve() call this function everytime.
1722 */ 1722 */
1723 struct nameidata nd; 1723 struct path path;
1724 1724
1725 if (path_lookup(tomoyo_loader, LOOKUP_FOLLOW, &nd)) { 1725 if (kern_path(tomoyo_loader, LOOKUP_FOLLOW, &path)) {
1726 printk(KERN_INFO "Not activating Mandatory Access Control now " 1726 printk(KERN_INFO "Not activating Mandatory Access Control now "
1727 "since %s doesn't exist.\n", tomoyo_loader); 1727 "since %s doesn't exist.\n", tomoyo_loader);
1728 return false; 1728 return false;
1729 } 1729 }
1730 path_put(&nd.path); 1730 path_put(&path);
1731 return true; 1731 return true;
1732} 1732}
1733 1733
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index bf8e2b451687..40927a84cb6e 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -165,11 +165,11 @@ char *tomoyo_realpath_from_path(struct path *path)
165 */ 165 */
166char *tomoyo_realpath(const char *pathname) 166char *tomoyo_realpath(const char *pathname)
167{ 167{
168 struct nameidata nd; 168 struct path path;
169 169
170 if (pathname && path_lookup(pathname, LOOKUP_FOLLOW, &nd) == 0) { 170 if (pathname && kern_path(pathname, LOOKUP_FOLLOW, &path) == 0) {
171 char *buf = tomoyo_realpath_from_path(&nd.path); 171 char *buf = tomoyo_realpath_from_path(&path);
172 path_put(&nd.path); 172 path_put(&path);
173 return buf; 173 return buf;
174 } 174 }
175 return NULL; 175 return NULL;
@@ -184,11 +184,11 @@ char *tomoyo_realpath(const char *pathname)
184 */ 184 */
185char *tomoyo_realpath_nofollow(const char *pathname) 185char *tomoyo_realpath_nofollow(const char *pathname)
186{ 186{
187 struct nameidata nd; 187 struct path path;
188 188
189 if (pathname && path_lookup(pathname, 0, &nd) == 0) { 189 if (pathname && kern_path(pathname, 0, &path) == 0) {
190 char *buf = tomoyo_realpath_from_path(&nd.path); 190 char *buf = tomoyo_realpath_from_path(&path);
191 path_put(&nd.path); 191 path_put(&path);
192 return buf; 192 return buf;
193 } 193 }
194 return NULL; 194 return NULL;
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 5b481912752a..e42be5c4f055 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -27,6 +27,12 @@ static int tomoyo_cred_prepare(struct cred *new, const struct cred *old,
27 27
28static int tomoyo_bprm_set_creds(struct linux_binprm *bprm) 28static int tomoyo_bprm_set_creds(struct linux_binprm *bprm)
29{ 29{
30 int rc;
31
32 rc = cap_bprm_set_creds(bprm);
33 if (rc)
34 return rc;
35
30 /* 36 /*
31 * Do only if this function is called for the first time of an execve 37 * Do only if this function is called for the first time of an execve
32 * operation. 38 * operation.