aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/keyctl.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-04-29 04:01:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:16 -0400
commit4a38e122e2cc6294779021ff4ccc784a3997059e (patch)
tree84b401b44e0550b04f831d98a91eacfd7cffb51d /security/keys/keyctl.c
parentdceba9944181b1fd5993417b5c8fa0e3dda38f8d (diff)
keys: allow the callout data to be passed as a blob rather than a string
Allow the callout data to be passed as a blob rather than a string for internal kernel services that call any request_key_*() interface other than request_key(). request_key() itself still takes a NUL-terminated string. The functions that change are: request_key_with_auxdata() request_key_async() request_key_async_with_auxdata() Signed-off-by: David Howells <dhowells@redhat.com> Cc: Paul Moore <paul.moore@hp.com> Cc: Chris Wright <chrisw@sous-sol.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/keys/keyctl.c')
-rw-r--r--security/keys/keyctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 8ec84326a983..1698bf90ee84 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -152,6 +152,7 @@ asmlinkage long sys_request_key(const char __user *_type,
152 struct key_type *ktype; 152 struct key_type *ktype;
153 struct key *key; 153 struct key *key;
154 key_ref_t dest_ref; 154 key_ref_t dest_ref;
155 size_t callout_len;
155 char type[32], *description, *callout_info; 156 char type[32], *description, *callout_info;
156 long ret; 157 long ret;
157 158
@@ -169,12 +170,14 @@ asmlinkage long sys_request_key(const char __user *_type,
169 170
170 /* pull the callout info into kernel space */ 171 /* pull the callout info into kernel space */
171 callout_info = NULL; 172 callout_info = NULL;
173 callout_len = 0;
172 if (_callout_info) { 174 if (_callout_info) {
173 callout_info = strndup_user(_callout_info, PAGE_SIZE); 175 callout_info = strndup_user(_callout_info, PAGE_SIZE);
174 if (IS_ERR(callout_info)) { 176 if (IS_ERR(callout_info)) {
175 ret = PTR_ERR(callout_info); 177 ret = PTR_ERR(callout_info);
176 goto error2; 178 goto error2;
177 } 179 }
180 callout_len = strlen(callout_info);
178 } 181 }
179 182
180 /* get the destination keyring if specified */ 183 /* get the destination keyring if specified */
@@ -195,8 +198,8 @@ asmlinkage long sys_request_key(const char __user *_type,
195 } 198 }
196 199
197 /* do the search */ 200 /* do the search */
198 key = request_key_and_link(ktype, description, callout_info, NULL, 201 key = request_key_and_link(ktype, description, callout_info,
199 key_ref_to_ptr(dest_ref), 202 callout_len, NULL, key_ref_to_ptr(dest_ref),
200 KEY_ALLOC_IN_QUOTA); 203 KEY_ALLOC_IN_QUOTA);
201 if (IS_ERR(key)) { 204 if (IS_ERR(key)) {
202 ret = PTR_ERR(key); 205 ret = PTR_ERR(key);