1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Key setup facility for FS encryption support. 4 * 5 * Copyright (C) 2015, Google, Inc. 6 * 7 * Originally written by Michael Halcrow, Ildar Muslukhov, and Uday Savagaonkar. 8 * Heavily modified since then. --- 381 unchanged lines hidden (view full) --- 390 return 0; 391 392 res = fscrypt_initialize(inode->i_sb->s_cop->flags); 393 if (res) 394 return res; 395 396 res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); 397 if (res < 0) { |
398 const union fscrypt_context *dummy_ctx = 399 fscrypt_get_dummy_context(inode->i_sb); 400 401 if (IS_ENCRYPTED(inode) || !dummy_ctx) { |
402 fscrypt_warn(inode, 403 "Error %d getting encryption context", 404 res); 405 return res; 406 } 407 /* Fake up a context for an unencrypted directory */ |
408 res = fscrypt_context_size(dummy_ctx); 409 memcpy(&ctx, dummy_ctx, res); |
410 } 411 412 crypt_info = kmem_cache_zalloc(fscrypt_info_cachep, GFP_NOFS); 413 if (!crypt_info) 414 return -ENOMEM; 415 416 crypt_info->ci_inode = inode; 417 --- 131 unchanged lines hidden --- |