diff options
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/ar-key.c | 19 |
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 | ||
28 | static int rxrpc_vet_description_s(const char *); | ||
28 | static int rxrpc_instantiate(struct key *, const void *, size_t); | 29 | static int rxrpc_instantiate(struct key *, const void *, size_t); |
29 | static int rxrpc_instantiate_s(struct key *, const void *, size_t); | 30 | static int rxrpc_instantiate_s(struct key *, const void *, size_t); |
30 | static void rxrpc_destroy(struct key *); | 31 | static void rxrpc_destroy(struct key *); |
@@ -52,6 +53,7 @@ EXPORT_SYMBOL(key_type_rxrpc); | |||
52 | */ | 53 | */ |
53 | struct key_type key_type_rxrpc_s = { | 54 | struct 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 | */ | ||
66 | static 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 | */ |