aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/keys/keyring.c15
-rw-r--r--security/selinux/hooks.c3
2 files changed, 10 insertions, 8 deletions
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 90a551e4da66..a1f6bac647a1 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -129,7 +129,7 @@ static int keyring_duplicate(struct key *keyring, const struct key *source)
129 int loop, ret; 129 int loop, ret;
130 130
131 const unsigned limit = 131 const unsigned limit =
132 (PAGE_SIZE - sizeof(*klist)) / sizeof(struct key); 132 (PAGE_SIZE - sizeof(*klist)) / sizeof(struct key *);
133 133
134 ret = 0; 134 ret = 0;
135 135
@@ -150,7 +150,7 @@ static int keyring_duplicate(struct key *keyring, const struct key *source)
150 max = limit; 150 max = limit;
151 151
152 ret = -ENOMEM; 152 ret = -ENOMEM;
153 size = sizeof(*klist) + sizeof(struct key) * max; 153 size = sizeof(*klist) + sizeof(struct key *) * max;
154 klist = kmalloc(size, GFP_KERNEL); 154 klist = kmalloc(size, GFP_KERNEL);
155 if (!klist) 155 if (!klist)
156 goto error; 156 goto error;
@@ -163,7 +163,7 @@ static int keyring_duplicate(struct key *keyring, const struct key *source)
163 klist->nkeys = sklist->nkeys; 163 klist->nkeys = sklist->nkeys;
164 memcpy(klist->keys, 164 memcpy(klist->keys,
165 sklist->keys, 165 sklist->keys,
166 sklist->nkeys * sizeof(struct key)); 166 sklist->nkeys * sizeof(struct key *));
167 167
168 for (loop = klist->nkeys - 1; loop >= 0; loop--) 168 for (loop = klist->nkeys - 1; loop >= 0; loop--)
169 atomic_inc(&klist->keys[loop]->usage); 169 atomic_inc(&klist->keys[loop]->usage);
@@ -783,7 +783,7 @@ int __key_link(struct key *keyring, struct key *key)
783 ret = -ENFILE; 783 ret = -ENFILE;
784 if (max > 65535) 784 if (max > 65535)
785 goto error3; 785 goto error3;
786 size = sizeof(*klist) + sizeof(*key) * max; 786 size = sizeof(*klist) + sizeof(struct key *) * max;
787 if (size > PAGE_SIZE) 787 if (size > PAGE_SIZE)
788 goto error3; 788 goto error3;
789 789
@@ -895,7 +895,8 @@ int key_unlink(struct key *keyring, struct key *key)
895 895
896key_is_present: 896key_is_present:
897 /* we need to copy the key list for RCU purposes */ 897 /* we need to copy the key list for RCU purposes */
898 nklist = kmalloc(sizeof(*klist) + sizeof(*key) * klist->maxkeys, 898 nklist = kmalloc(sizeof(*klist) +
899 sizeof(struct key *) * klist->maxkeys,
899 GFP_KERNEL); 900 GFP_KERNEL);
900 if (!nklist) 901 if (!nklist)
901 goto nomem; 902 goto nomem;
@@ -905,12 +906,12 @@ key_is_present:
905 if (loop > 0) 906 if (loop > 0)
906 memcpy(&nklist->keys[0], 907 memcpy(&nklist->keys[0],
907 &klist->keys[0], 908 &klist->keys[0],
908 loop * sizeof(klist->keys[0])); 909 loop * sizeof(struct key *));
909 910
910 if (loop < nklist->nkeys) 911 if (loop < nklist->nkeys)
911 memcpy(&nklist->keys[loop], 912 memcpy(&nklist->keys[loop],
912 &klist->keys[loop + 1], 913 &klist->keys[loop + 1],
913 (nklist->nkeys - loop) * sizeof(klist->keys[0])); 914 (nklist->nkeys - loop) * sizeof(struct key *));
914 915
915 /* adjust the user's quota */ 916 /* adjust the user's quota */
916 key_payload_reserve(keyring, 917 key_payload_reserve(keyring,
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 17a1189f1ff8..6be273851144 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -68,6 +68,7 @@
68#include <linux/personality.h> 68#include <linux/personality.h>
69#include <linux/sysctl.h> 69#include <linux/sysctl.h>
70#include <linux/audit.h> 70#include <linux/audit.h>
71#include <linux/string.h>
71 72
72#include "avc.h" 73#include "avc.h"
73#include "objsec.h" 74#include "objsec.h"
@@ -1943,7 +1944,7 @@ static int selinux_sb_copy_data(struct file_system_type *type, void *orig, void
1943 } 1944 }
1944 } while (*in_end++); 1945 } while (*in_end++);
1945 1946
1946 copy_page(in_save, nosec_save); 1947 strcpy(in_save, nosec_save);
1947 free_page((unsigned long)nosec_save); 1948 free_page((unsigned long)nosec_save);
1948out: 1949out:
1949 return rc; 1950 return rc;