diff options
Diffstat (limited to 'security')
| -rw-r--r-- | security/Kconfig | 2 | ||||
| -rw-r--r-- | security/capability.c | 3 | ||||
| -rw-r--r-- | security/keys/compat.c | 4 | ||||
| -rw-r--r-- | security/keys/keyring.c | 6 | ||||
| -rw-r--r-- | security/security.c | 6 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 13 | ||||
| -rw-r--r-- | security/selinux/include/security.h | 2 | ||||
| -rw-r--r-- | security/selinux/include/xfrm.h | 3 | ||||
| -rw-r--r-- | security/selinux/nlmsgtab.c | 2 | ||||
| -rw-r--r-- | security/selinux/selinuxfs.c | 28 | ||||
| -rw-r--r-- | security/selinux/ss/policydb.c | 8 | ||||
| -rw-r--r-- | security/selinux/ss/services.c | 10 | ||||
| -rw-r--r-- | security/selinux/xfrm.c | 14 |
13 files changed, 64 insertions, 37 deletions
diff --git a/security/Kconfig b/security/Kconfig index e9c6ac724fef..beb86b500adf 100644 --- a/security/Kconfig +++ b/security/Kconfig | |||
| @@ -103,7 +103,7 @@ config INTEL_TXT | |||
| 103 | config LSM_MMAP_MIN_ADDR | 103 | config LSM_MMAP_MIN_ADDR |
| 104 | int "Low address space for LSM to protect from user allocation" | 104 | int "Low address space for LSM to protect from user allocation" |
| 105 | depends on SECURITY && SECURITY_SELINUX | 105 | depends on SECURITY && SECURITY_SELINUX |
| 106 | default 32768 if ARM | 106 | default 32768 if ARM || (ARM64 && COMPAT) |
| 107 | default 65536 | 107 | default 65536 |
| 108 | help | 108 | help |
| 109 | This is the portion of low virtual memory which should be protected | 109 | This is the portion of low virtual memory which should be protected |
diff --git a/security/capability.c b/security/capability.c index 8b4f24ae4338..21e2b9cae685 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -757,7 +757,8 @@ static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |||
| 757 | 757 | ||
| 758 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 758 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| 759 | static int cap_xfrm_policy_alloc_security(struct xfrm_sec_ctx **ctxp, | 759 | static int cap_xfrm_policy_alloc_security(struct xfrm_sec_ctx **ctxp, |
| 760 | struct xfrm_user_sec_ctx *sec_ctx) | 760 | struct xfrm_user_sec_ctx *sec_ctx, |
| 761 | gfp_t gfp) | ||
| 761 | { | 762 | { |
| 762 | return 0; | 763 | return 0; |
| 763 | } | 764 | } |
diff --git a/security/keys/compat.c b/security/keys/compat.c index bbd32c729dbb..347896548ad3 100644 --- a/security/keys/compat.c +++ b/security/keys/compat.c | |||
| @@ -65,8 +65,8 @@ no_payload: | |||
| 65 | * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl() | 65 | * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl() |
| 66 | * directly. | 66 | * directly. |
| 67 | */ | 67 | */ |
| 68 | asmlinkage long compat_sys_keyctl(u32 option, | 68 | COMPAT_SYSCALL_DEFINE5(keyctl, u32, option, |
| 69 | u32 arg2, u32 arg3, u32 arg4, u32 arg5) | 69 | u32, arg2, u32, arg3, u32, arg4, u32, arg5) |
| 70 | { | 70 | { |
| 71 | switch (option) { | 71 | switch (option) { |
| 72 | case KEYCTL_GET_KEYRING_ID: | 72 | case KEYCTL_GET_KEYRING_ID: |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index d46cbc5e335e..2fb2576dc644 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
| @@ -1000,7 +1000,11 @@ static int keyring_detect_cycle_iterator(const void *object, | |||
| 1000 | 1000 | ||
| 1001 | kenter("{%d}", key->serial); | 1001 | kenter("{%d}", key->serial); |
| 1002 | 1002 | ||
| 1003 | BUG_ON(key != ctx->match_data); | 1003 | /* We might get a keyring with matching index-key that is nonetheless a |
| 1004 | * different keyring. */ | ||
| 1005 | if (key != ctx->match_data) | ||
| 1006 | return 0; | ||
| 1007 | |||
| 1004 | ctx->result = ERR_PTR(-EDEADLK); | 1008 | ctx->result = ERR_PTR(-EDEADLK); |
| 1005 | return 1; | 1009 | return 1; |
| 1006 | } | 1010 | } |
diff --git a/security/security.c b/security/security.c index 15b6928592ef..919cad93ac82 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -1317,9 +1317,11 @@ void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) | |||
| 1317 | 1317 | ||
| 1318 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1318 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| 1319 | 1319 | ||
| 1320 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) | 1320 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
| 1321 | struct xfrm_user_sec_ctx *sec_ctx, | ||
| 1322 | gfp_t gfp) | ||
| 1321 | { | 1323 | { |
| 1322 | return security_ops->xfrm_policy_alloc_security(ctxp, sec_ctx); | 1324 | return security_ops->xfrm_policy_alloc_security(ctxp, sec_ctx, gfp); |
| 1323 | } | 1325 | } |
| 1324 | EXPORT_SYMBOL(security_xfrm_policy_alloc); | 1326 | EXPORT_SYMBOL(security_xfrm_policy_alloc); |
| 1325 | 1327 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4b34847208cc..b332e2cc0954 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -668,7 +668,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
| 668 | if (flags[i] == SBLABEL_MNT) | 668 | if (flags[i] == SBLABEL_MNT) |
| 669 | continue; | 669 | continue; |
| 670 | rc = security_context_to_sid(mount_options[i], | 670 | rc = security_context_to_sid(mount_options[i], |
| 671 | strlen(mount_options[i]), &sid); | 671 | strlen(mount_options[i]), &sid, GFP_KERNEL); |
| 672 | if (rc) { | 672 | if (rc) { |
| 673 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 673 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
| 674 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 674 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
| @@ -2489,7 +2489,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data) | |||
| 2489 | if (flags[i] == SBLABEL_MNT) | 2489 | if (flags[i] == SBLABEL_MNT) |
| 2490 | continue; | 2490 | continue; |
| 2491 | len = strlen(mount_options[i]); | 2491 | len = strlen(mount_options[i]); |
| 2492 | rc = security_context_to_sid(mount_options[i], len, &sid); | 2492 | rc = security_context_to_sid(mount_options[i], len, &sid, |
| 2493 | GFP_KERNEL); | ||
| 2493 | if (rc) { | 2494 | if (rc) { |
| 2494 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 2495 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
| 2495 | "(%s) failed for (dev %s, type %s) errno=%d\n", | 2496 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
| @@ -2893,7 +2894,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
| 2893 | if (rc) | 2894 | if (rc) |
| 2894 | return rc; | 2895 | return rc; |
| 2895 | 2896 | ||
| 2896 | rc = security_context_to_sid(value, size, &newsid); | 2897 | rc = security_context_to_sid(value, size, &newsid, GFP_KERNEL); |
| 2897 | if (rc == -EINVAL) { | 2898 | if (rc == -EINVAL) { |
| 2898 | if (!capable(CAP_MAC_ADMIN)) { | 2899 | if (!capable(CAP_MAC_ADMIN)) { |
| 2899 | struct audit_buffer *ab; | 2900 | struct audit_buffer *ab; |
| @@ -3050,7 +3051,7 @@ static int selinux_inode_setsecurity(struct inode *inode, const char *name, | |||
| 3050 | if (!value || !size) | 3051 | if (!value || !size) |
| 3051 | return -EACCES; | 3052 | return -EACCES; |
| 3052 | 3053 | ||
| 3053 | rc = security_context_to_sid((void *)value, size, &newsid); | 3054 | rc = security_context_to_sid((void *)value, size, &newsid, GFP_KERNEL); |
| 3054 | if (rc) | 3055 | if (rc) |
| 3055 | return rc; | 3056 | return rc; |
| 3056 | 3057 | ||
| @@ -5529,7 +5530,7 @@ static int selinux_setprocattr(struct task_struct *p, | |||
| 5529 | str[size-1] = 0; | 5530 | str[size-1] = 0; |
| 5530 | size--; | 5531 | size--; |
| 5531 | } | 5532 | } |
| 5532 | error = security_context_to_sid(value, size, &sid); | 5533 | error = security_context_to_sid(value, size, &sid, GFP_KERNEL); |
| 5533 | if (error == -EINVAL && !strcmp(name, "fscreate")) { | 5534 | if (error == -EINVAL && !strcmp(name, "fscreate")) { |
| 5534 | if (!capable(CAP_MAC_ADMIN)) { | 5535 | if (!capable(CAP_MAC_ADMIN)) { |
| 5535 | struct audit_buffer *ab; | 5536 | struct audit_buffer *ab; |
| @@ -5638,7 +5639,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | |||
| 5638 | 5639 | ||
| 5639 | 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) |
| 5640 | { | 5641 | { |
| 5641 | return security_context_to_sid(secdata, seclen, secid); | 5642 | return security_context_to_sid(secdata, seclen, secid, GFP_KERNEL); |
| 5642 | } | 5643 | } |
| 5643 | 5644 | ||
| 5644 | static void selinux_release_secctx(char *secdata, u32 seclen) | 5645 | static void selinux_release_secctx(char *secdata, u32 seclen) |
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 8ed8daf7f1ee..ce7852cf526b 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h | |||
| @@ -134,7 +134,7 @@ int security_sid_to_context(u32 sid, char **scontext, | |||
| 134 | int security_sid_to_context_force(u32 sid, char **scontext, u32 *scontext_len); | 134 | int security_sid_to_context_force(u32 sid, char **scontext, u32 *scontext_len); |
| 135 | 135 | ||
| 136 | int security_context_to_sid(const char *scontext, u32 scontext_len, | 136 | int security_context_to_sid(const char *scontext, u32 scontext_len, |
| 137 | u32 *out_sid); | 137 | u32 *out_sid, gfp_t gfp); |
| 138 | 138 | ||
| 139 | int security_context_to_sid_default(const char *scontext, u32 scontext_len, | 139 | int security_context_to_sid_default(const char *scontext, u32 scontext_len, |
| 140 | u32 *out_sid, u32 def_sid, gfp_t gfp_flags); | 140 | u32 *out_sid, u32 def_sid, gfp_t gfp_flags); |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index 48c3cc94c168..9f0584710c85 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
| @@ -10,7 +10,8 @@ | |||
| 10 | #include <net/flow.h> | 10 | #include <net/flow.h> |
| 11 | 11 | ||
| 12 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, | 12 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
| 13 | struct xfrm_user_sec_ctx *uctx); | 13 | struct xfrm_user_sec_ctx *uctx, |
| 14 | gfp_t gfp); | ||
| 14 | int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, | 15 | int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, |
| 15 | struct xfrm_sec_ctx **new_ctxp); | 16 | struct xfrm_sec_ctx **new_ctxp); |
| 16 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx); | 17 | void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx); |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 332ac8a80cf5..2df7b900e259 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/inet_diag.h> | 17 | #include <linux/inet_diag.h> |
| 18 | #include <linux/xfrm.h> | 18 | #include <linux/xfrm.h> |
| 19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
| 20 | #include <linux/sock_diag.h> | ||
| 20 | 21 | ||
| 21 | #include "flask.h" | 22 | #include "flask.h" |
| 22 | #include "av_permissions.h" | 23 | #include "av_permissions.h" |
| @@ -78,6 +79,7 @@ static struct nlmsg_perm nlmsg_tcpdiag_perms[] = | |||
| 78 | { | 79 | { |
| 79 | { TCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | 80 | { TCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, |
| 80 | { DCCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | 81 | { DCCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, |
| 82 | { SOCK_DIAG_BY_FAMILY, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | ||
| 81 | }; | 83 | }; |
| 82 | 84 | ||
| 83 | static struct nlmsg_perm nlmsg_xfrm_perms[] = | 85 | static struct nlmsg_perm nlmsg_xfrm_perms[] = |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 5122affe06a8..d60c0ee66387 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
| @@ -576,7 +576,7 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size) | |||
| 576 | if (length) | 576 | if (length) |
| 577 | goto out; | 577 | goto out; |
| 578 | 578 | ||
| 579 | length = security_context_to_sid(buf, size, &sid); | 579 | length = security_context_to_sid(buf, size, &sid, GFP_KERNEL); |
| 580 | if (length) | 580 | if (length) |
| 581 | goto out; | 581 | goto out; |
| 582 | 582 | ||
| @@ -731,11 +731,13 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size) | |||
| 731 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 731 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
| 732 | goto out; | 732 | goto out; |
| 733 | 733 | ||
| 734 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 734 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
| 735 | GFP_KERNEL); | ||
| 735 | if (length) | 736 | if (length) |
| 736 | goto out; | 737 | goto out; |
| 737 | 738 | ||
| 738 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 739 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
| 740 | GFP_KERNEL); | ||
| 739 | if (length) | 741 | if (length) |
| 740 | goto out; | 742 | goto out; |
| 741 | 743 | ||
| @@ -817,11 +819,13 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) | |||
| 817 | objname = namebuf; | 819 | objname = namebuf; |
| 818 | } | 820 | } |
| 819 | 821 | ||
| 820 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 822 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
| 823 | GFP_KERNEL); | ||
| 821 | if (length) | 824 | if (length) |
| 822 | goto out; | 825 | goto out; |
| 823 | 826 | ||
| 824 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 827 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
| 828 | GFP_KERNEL); | ||
| 825 | if (length) | 829 | if (length) |
| 826 | goto out; | 830 | goto out; |
| 827 | 831 | ||
| @@ -878,11 +882,13 @@ static ssize_t sel_write_relabel(struct file *file, char *buf, size_t size) | |||
| 878 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 882 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
| 879 | goto out; | 883 | goto out; |
| 880 | 884 | ||
| 881 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 885 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
| 886 | GFP_KERNEL); | ||
| 882 | if (length) | 887 | if (length) |
| 883 | goto out; | 888 | goto out; |
| 884 | 889 | ||
| 885 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 890 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
| 891 | GFP_KERNEL); | ||
| 886 | if (length) | 892 | if (length) |
| 887 | goto out; | 893 | goto out; |
| 888 | 894 | ||
| @@ -934,7 +940,7 @@ static ssize_t sel_write_user(struct file *file, char *buf, size_t size) | |||
| 934 | if (sscanf(buf, "%s %s", con, user) != 2) | 940 | if (sscanf(buf, "%s %s", con, user) != 2) |
| 935 | goto out; | 941 | goto out; |
| 936 | 942 | ||
| 937 | length = security_context_to_sid(con, strlen(con) + 1, &sid); | 943 | length = security_context_to_sid(con, strlen(con) + 1, &sid, GFP_KERNEL); |
| 938 | if (length) | 944 | if (length) |
| 939 | goto out; | 945 | goto out; |
| 940 | 946 | ||
| @@ -994,11 +1000,13 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) | |||
| 994 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) | 1000 | if (sscanf(buf, "%s %s %hu", scon, tcon, &tclass) != 3) |
| 995 | goto out; | 1001 | goto out; |
| 996 | 1002 | ||
| 997 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid); | 1003 | length = security_context_to_sid(scon, strlen(scon) + 1, &ssid, |
| 1004 | GFP_KERNEL); | ||
| 998 | if (length) | 1005 | if (length) |
| 999 | goto out; | 1006 | goto out; |
| 1000 | 1007 | ||
| 1001 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid); | 1008 | length = security_context_to_sid(tcon, strlen(tcon) + 1, &tsid, |
| 1009 | GFP_KERNEL); | ||
| 1002 | if (length) | 1010 | if (length) |
| 1003 | goto out; | 1011 | goto out; |
| 1004 | 1012 | ||
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index c0f498842129..9c5cdc2caaef 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
| @@ -3338,10 +3338,10 @@ static int filename_write_helper(void *key, void *data, void *ptr) | |||
| 3338 | if (rc) | 3338 | if (rc) |
| 3339 | return rc; | 3339 | return rc; |
| 3340 | 3340 | ||
| 3341 | buf[0] = ft->stype; | 3341 | buf[0] = cpu_to_le32(ft->stype); |
| 3342 | buf[1] = ft->ttype; | 3342 | buf[1] = cpu_to_le32(ft->ttype); |
| 3343 | buf[2] = ft->tclass; | 3343 | buf[2] = cpu_to_le32(ft->tclass); |
| 3344 | buf[3] = otype->otype; | 3344 | buf[3] = cpu_to_le32(otype->otype); |
| 3345 | 3345 | ||
| 3346 | rc = put_entry(buf, sizeof(u32), 4, fp); | 3346 | rc = put_entry(buf, sizeof(u32), 4, fp); |
| 3347 | if (rc) | 3347 | if (rc) |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index c93c21127f0c..4bca49414a40 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
| @@ -1232,6 +1232,10 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, | |||
| 1232 | struct context context; | 1232 | struct context context; |
| 1233 | int rc = 0; | 1233 | int rc = 0; |
| 1234 | 1234 | ||
| 1235 | /* An empty security context is never valid. */ | ||
| 1236 | if (!scontext_len) | ||
| 1237 | return -EINVAL; | ||
| 1238 | |||
| 1235 | if (!ss_initialized) { | 1239 | if (!ss_initialized) { |
| 1236 | int i; | 1240 | int i; |
| 1237 | 1241 | ||
| @@ -1285,16 +1289,18 @@ out: | |||
| 1285 | * @scontext: security context | 1289 | * @scontext: security context |
| 1286 | * @scontext_len: length in bytes | 1290 | * @scontext_len: length in bytes |
| 1287 | * @sid: security identifier, SID | 1291 | * @sid: security identifier, SID |
| 1292 | * @gfp: context for the allocation | ||
| 1288 | * | 1293 | * |
| 1289 | * Obtains a SID associated with the security context that | 1294 | * Obtains a SID associated with the security context that |
| 1290 | * has the string representation specified by @scontext. | 1295 | * has the string representation specified by @scontext. |
| 1291 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient | 1296 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient |
| 1292 | * memory is available, or 0 on success. | 1297 | * memory is available, or 0 on success. |
| 1293 | */ | 1298 | */ |
| 1294 | int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid) | 1299 | int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid, |
| 1300 | gfp_t gfp) | ||
| 1295 | { | 1301 | { |
| 1296 | return security_context_to_sid_core(scontext, scontext_len, | 1302 | return security_context_to_sid_core(scontext, scontext_len, |
| 1297 | sid, SECSID_NULL, GFP_KERNEL, 0); | 1303 | sid, SECSID_NULL, gfp, 0); |
| 1298 | } | 1304 | } |
| 1299 | 1305 | ||
| 1300 | /** | 1306 | /** |
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index 0462cb3ff0a7..98b042630a9e 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
| @@ -78,7 +78,8 @@ static inline int selinux_authorizable_xfrm(struct xfrm_state *x) | |||
| 78 | * xfrm_user_sec_ctx context. | 78 | * xfrm_user_sec_ctx context. |
| 79 | */ | 79 | */ |
| 80 | static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | 80 | static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, |
| 81 | struct xfrm_user_sec_ctx *uctx) | 81 | struct xfrm_user_sec_ctx *uctx, |
| 82 | gfp_t gfp) | ||
| 82 | { | 83 | { |
| 83 | int rc; | 84 | int rc; |
| 84 | const struct task_security_struct *tsec = current_security(); | 85 | const struct task_security_struct *tsec = current_security(); |
| @@ -94,7 +95,7 @@ static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | |||
| 94 | if (str_len >= PAGE_SIZE) | 95 | if (str_len >= PAGE_SIZE) |
| 95 | return -ENOMEM; | 96 | return -ENOMEM; |
| 96 | 97 | ||
| 97 | ctx = kmalloc(sizeof(*ctx) + str_len + 1, GFP_KERNEL); | 98 | ctx = kmalloc(sizeof(*ctx) + str_len + 1, gfp); |
| 98 | if (!ctx) | 99 | if (!ctx) |
| 99 | return -ENOMEM; | 100 | return -ENOMEM; |
| 100 | 101 | ||
| @@ -103,7 +104,7 @@ static int selinux_xfrm_alloc_user(struct xfrm_sec_ctx **ctxp, | |||
| 103 | ctx->ctx_len = str_len; | 104 | ctx->ctx_len = str_len; |
| 104 | memcpy(ctx->ctx_str, &uctx[1], str_len); | 105 | memcpy(ctx->ctx_str, &uctx[1], str_len); |
| 105 | ctx->ctx_str[str_len] = '\0'; | 106 | ctx->ctx_str[str_len] = '\0'; |
| 106 | rc = security_context_to_sid(ctx->ctx_str, str_len, &ctx->ctx_sid); | 107 | rc = security_context_to_sid(ctx->ctx_str, str_len, &ctx->ctx_sid, gfp); |
| 107 | if (rc) | 108 | if (rc) |
| 108 | goto err; | 109 | goto err; |
| 109 | 110 | ||
| @@ -282,9 +283,10 @@ int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid) | |||
| 282 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. | 283 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. |
| 283 | */ | 284 | */ |
| 284 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, | 285 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
| 285 | struct xfrm_user_sec_ctx *uctx) | 286 | struct xfrm_user_sec_ctx *uctx, |
| 287 | gfp_t gfp) | ||
| 286 | { | 288 | { |
| 287 | return selinux_xfrm_alloc_user(ctxp, uctx); | 289 | return selinux_xfrm_alloc_user(ctxp, uctx, gfp); |
| 288 | } | 290 | } |
| 289 | 291 | ||
| 290 | /* | 292 | /* |
| @@ -332,7 +334,7 @@ int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) | |||
| 332 | int selinux_xfrm_state_alloc(struct xfrm_state *x, | 334 | int selinux_xfrm_state_alloc(struct xfrm_state *x, |
| 333 | struct xfrm_user_sec_ctx *uctx) | 335 | struct xfrm_user_sec_ctx *uctx) |
| 334 | { | 336 | { |
| 335 | return selinux_xfrm_alloc_user(&x->security, uctx); | 337 | return selinux_xfrm_alloc_user(&x->security, uctx, GFP_KERNEL); |
| 336 | } | 338 | } |
| 337 | 339 | ||
| 338 | /* | 340 | /* |
