diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 57b0b49f4e6e..b332e2cc0954 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -82,7 +82,6 @@ | |||
82 | #include <linux/syslog.h> | 82 | #include <linux/syslog.h> |
83 | #include <linux/user_namespace.h> | 83 | #include <linux/user_namespace.h> |
84 | #include <linux/export.h> | 84 | #include <linux/export.h> |
85 | #include <linux/security.h> | ||
86 | #include <linux/msg.h> | 85 | #include <linux/msg.h> |
87 | #include <linux/shm.h> | 86 | #include <linux/shm.h> |
88 | 87 | ||
@@ -669,7 +668,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
669 | if (flags[i] == SBLABEL_MNT) | 668 | if (flags[i] == SBLABEL_MNT) |
670 | continue; | 669 | continue; |
671 | rc = security_context_to_sid(mount_options[i], | 670 | rc = security_context_to_sid(mount_options[i], |
672 | strlen(mount_options[i]), &sid); | 671 | strlen(mount_options[i]), &sid, GFP_KERNEL); |
673 | if (rc) { | 672 | if (rc) { |
674 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 673 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
675 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 674 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
@@ -2490,7 +2489,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data) | |||
2490 | if (flags[i] == SBLABEL_MNT) | 2489 | if (flags[i] == SBLABEL_MNT) |
2491 | continue; | 2490 | continue; |
2492 | len = strlen(mount_options[i]); | 2491 | len = strlen(mount_options[i]); |
2493 | rc = security_context_to_sid(mount_options[i], len, &sid); | 2492 | rc = security_context_to_sid(mount_options[i], len, &sid, |
2493 | GFP_KERNEL); | ||
2494 | if (rc) { | 2494 | if (rc) { |
2495 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 2495 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
2496 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 2496 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
@@ -2894,7 +2894,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2894 | if (rc) | 2894 | if (rc) |
2895 | return rc; | 2895 | return rc; |
2896 | 2896 | ||
2897 | rc = security_context_to_sid(value, size, &newsid); | 2897 | rc = security_context_to_sid(value, size, &newsid, GFP_KERNEL); |
2898 | if (rc == -EINVAL) { | 2898 | if (rc == -EINVAL) { |
2899 | if (!capable(CAP_MAC_ADMIN)) { | 2899 | if (!capable(CAP_MAC_ADMIN)) { |
2900 | struct audit_buffer *ab; | 2900 | struct audit_buffer *ab; |
@@ -3051,7 +3051,7 @@ static int selinux_inode_setsecurity(struct inode *inode, const char *name, | |||
3051 | if (!value || !size) | 3051 | if (!value || !size) |
3052 | return -EACCES; | 3052 | return -EACCES; |
3053 | 3053 | ||
3054 | rc = security_context_to_sid((void *)value, size, &newsid); | 3054 | rc = security_context_to_sid((void *)value, size, &newsid, GFP_KERNEL); |
3055 | if (rc) | 3055 | if (rc) |
3056 | return rc; | 3056 | return rc; |
3057 | 3057 | ||
@@ -4490,14 +4490,10 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
4490 | { | 4490 | { |
4491 | struct sk_security_struct *sksec = sk->sk_security; | 4491 | struct sk_security_struct *sksec = sk->sk_security; |
4492 | int err; | 4492 | int err; |
4493 | u16 family = sk->sk_family; | 4493 | u16 family = req->rsk_ops->family; |
4494 | u32 connsid; | 4494 | u32 connsid; |
4495 | u32 peersid; | 4495 | u32 peersid; |
4496 | 4496 | ||
4497 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ | ||
4498 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) | ||
4499 | family = PF_INET; | ||
4500 | |||
4501 | err = selinux_skb_peerlbl_sid(skb, family, &peersid); | 4497 | err = selinux_skb_peerlbl_sid(skb, family, &peersid); |
4502 | if (err) | 4498 | if (err) |
4503 | return err; | 4499 | return err; |
@@ -5534,7 +5530,7 @@ static int selinux_setprocattr(struct task_struct *p, | |||
5534 | str[size-1] = 0; | 5530 | str[size-1] = 0; |
5535 | size--; | 5531 | size--; |
5536 | } | 5532 | } |
5537 | error = security_context_to_sid(value, size, &sid); | 5533 | error = security_context_to_sid(value, size, &sid, GFP_KERNEL); |
5538 | if (error == -EINVAL && !strcmp(name, "fscreate")) { | 5534 | if (error == -EINVAL && !strcmp(name, "fscreate")) { |
5539 | if (!capable(CAP_MAC_ADMIN)) { | 5535 | if (!capable(CAP_MAC_ADMIN)) { |
5540 | struct audit_buffer *ab; | 5536 | struct audit_buffer *ab; |
@@ -5643,7 +5639,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
5643 | 5639 | ||
5644 | static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) | 5640 | static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) |
5645 | { | 5641 | { |
5646 | return security_context_to_sid(secdata, seclen, secid); | 5642 | return security_context_to_sid(secdata, seclen, secid, GFP_KERNEL); |
5647 | } | 5643 | } |
5648 | 5644 | ||
5649 | static void selinux_release_secctx(char *secdata, u32 seclen) | 5645 | static void selinux_release_secctx(char *secdata, u32 seclen) |