aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 12:15:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 12:15:43 -0400
commit0f6e0e8448a16d8d22119ce91d8dd24b44865b51 (patch)
tree7c295c02db035fc6a0b867465911a2bc9dc6b1ef /net
parent0d2ecee2bdb2a19d04bc5cefac0f86e790f1aad4 (diff)
parenta002951c97ff8da49938c982a4c236bf2fafdc9f (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (33 commits) AppArmor: kill unused macros in lsm.c AppArmor: cleanup generated files correctly KEYS: Add an iovec version of KEYCTL_INSTANTIATE KEYS: Add a new keyctl op to reject a key with a specified error code KEYS: Add a key type op to permit the key description to be vetted KEYS: Add an RCU payload dereference macro AppArmor: Cleanup make file to remove cruft and make it easier to read SELinux: implement the new sb_remount LSM hook LSM: Pass -o remount options to the LSM SELinux: Compute SID for the newly created socket SELinux: Socket retains creator role and MLS attribute SELinux: Auto-generate security_is_socket_class TOMOYO: Fix memory leak upon file open. Revert "selinux: simplify ioctl checking" selinux: drop unused packet flow permissions selinux: Fix packet forwarding checks on postrouting selinux: Fix wrong checks for selinux_policycap_netpeer selinux: Fix check for xfrm selinux context algorithm ima: remove unnecessary call to ima_must_measure IMA: remove IMA imbalance checking ...
Diffstat (limited to 'net')
-rw-r--r--net/rxrpc/ar-key.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index d763793d39de..43ea7de2fc8e 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -25,6 +25,7 @@
25#include <keys/user-type.h> 25#include <keys/user-type.h>
26#include "ar-internal.h" 26#include "ar-internal.h"
27 27
28static int rxrpc_vet_description_s(const char *);
28static int rxrpc_instantiate(struct key *, const void *, size_t); 29static int rxrpc_instantiate(struct key *, const void *, size_t);
29static int rxrpc_instantiate_s(struct key *, const void *, size_t); 30static int rxrpc_instantiate_s(struct key *, const void *, size_t);
30static void rxrpc_destroy(struct key *); 31static void rxrpc_destroy(struct key *);
@@ -52,6 +53,7 @@ EXPORT_SYMBOL(key_type_rxrpc);
52 */ 53 */
53struct key_type key_type_rxrpc_s = { 54struct key_type key_type_rxrpc_s = {
54 .name = "rxrpc_s", 55 .name = "rxrpc_s",
56 .vet_description = rxrpc_vet_description_s,
55 .instantiate = rxrpc_instantiate_s, 57 .instantiate = rxrpc_instantiate_s,
56 .match = user_match, 58 .match = user_match,
57 .destroy = rxrpc_destroy_s, 59 .destroy = rxrpc_destroy_s,
@@ -59,6 +61,23 @@ struct key_type key_type_rxrpc_s = {
59}; 61};
60 62
61/* 63/*
64 * Vet the description for an RxRPC server key
65 */
66static int rxrpc_vet_description_s(const char *desc)
67{
68 unsigned long num;
69 char *p;
70
71 num = simple_strtoul(desc, &p, 10);
72 if (*p != ':' || num > 65535)
73 return -EINVAL;
74 num = simple_strtoul(p + 1, &p, 10);
75 if (*p || num < 1 || num > 255)
76 return -EINVAL;
77 return 0;
78}
79
80/*
62 * parse an RxKAD type XDR format token 81 * parse an RxKAD type XDR format token
63 * - the caller guarantees we have at least 4 words 82 * - the caller guarantees we have at least 4 words
64 */ 83 */