aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/ceph_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/ceph_common.c')
-rw-r--r--net/ceph/ceph_common.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index c92bc8d50597..132963abc266 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -6,7 +6,7 @@
6#include <linux/inet.h> 6#include <linux/inet.h>
7#include <linux/in6.h> 7#include <linux/in6.h>
8#include <linux/key.h> 8#include <linux/key.h>
9#include <keys/user-type.h> 9#include <keys/ceph-type.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/mount.h> 11#include <linux/mount.h>
12#include <linux/parser.h> 12#include <linux/parser.h>
@@ -241,10 +241,9 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
241 struct key *ukey; 241 struct key *ukey;
242 int key_err; 242 int key_err;
243 int err = 0; 243 int err = 0;
244 struct user_key_payload *payload; 244 struct ceph_crypto_key *ckey;
245 void *p;
246 245
247 ukey = request_key(&key_type_user, name, NULL); 246 ukey = request_key(&key_type_ceph, name, NULL);
248 if (!ukey || IS_ERR(ukey)) { 247 if (!ukey || IS_ERR(ukey)) {
249 /* request_key errors don't map nicely to mount(2) 248 /* request_key errors don't map nicely to mount(2)
250 errors; don't even try, but still printk */ 249 errors; don't even try, but still printk */
@@ -267,9 +266,8 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
267 goto out; 266 goto out;
268 } 267 }
269 268
270 payload = ukey->payload.data; 269 ckey = ukey->payload.data;
271 p = payload->data; 270 err = ceph_crypto_key_clone(dst, ckey);
272 err = ceph_crypto_key_decode(dst, &p, p + payload->datalen);
273 if (err) 271 if (err)
274 goto out_key; 272 goto out_key;
275 /* pass through, err is 0 */ 273 /* pass through, err is 0 */
@@ -583,10 +581,14 @@ static int __init init_ceph_lib(void)
583 if (ret < 0) 581 if (ret < 0)
584 goto out; 582 goto out;
585 583
586 ret = ceph_msgr_init(); 584 ret = ceph_crypto_init();
587 if (ret < 0) 585 if (ret < 0)
588 goto out_debugfs; 586 goto out_debugfs;
589 587
588 ret = ceph_msgr_init();
589 if (ret < 0)
590 goto out_crypto;
591
590 pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n", 592 pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n",
591 CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL, 593 CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL,
592 CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT, 594 CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT,
@@ -594,6 +596,8 @@ static int __init init_ceph_lib(void)
594 596
595 return 0; 597 return 0;
596 598
599out_crypto:
600 ceph_crypto_shutdown();
597out_debugfs: 601out_debugfs:
598 ceph_debugfs_cleanup(); 602 ceph_debugfs_cleanup();
599out: 603out:
@@ -604,6 +608,7 @@ static void __exit exit_ceph_lib(void)
604{ 608{
605 dout("exit_ceph_lib\n"); 609 dout("exit_ceph_lib\n");
606 ceph_msgr_exit(); 610 ceph_msgr_exit();
611 ceph_crypto_shutdown();
607 ceph_debugfs_cleanup(); 612 ceph_debugfs_cleanup();
608} 613}
609 614