aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r--fs/ecryptfs/crypto.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 9127b809044d..e3d2118fafad 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1277,8 +1277,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
1277 mm_segment_t oldfs; 1277 mm_segment_t oldfs;
1278 int rc; 1278 int rc;
1279 1279
1280 if ((rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, 1280 rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, O_RDONLY);
1281 O_RDONLY))) { 1281 if (rc) {
1282 printk(KERN_ERR 1282 printk(KERN_ERR
1283 "Error opening lower_file to read header region\n"); 1283 "Error opening lower_file to read header region\n");
1284 goto out; 1284 goto out;
@@ -1289,7 +1289,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
1289 rc = lower_file->f_op->read(lower_file, (char __user *)data, 1289 rc = lower_file->f_op->read(lower_file, (char __user *)data,
1290 ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos); 1290 ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos);
1291 set_fs(oldfs); 1291 set_fs(oldfs);
1292 if ((rc = ecryptfs_close_lower_file(lower_file))) { 1292 rc = ecryptfs_close_lower_file(lower_file);
1293 if (rc) {
1293 printk(KERN_ERR "Error closing lower_file\n"); 1294 printk(KERN_ERR "Error closing lower_file\n");
1294 goto out; 1295 goto out;
1295 } 1296 }
@@ -1951,9 +1952,10 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
1951 strncpy(tmp_tfm->cipher_name, cipher_name, 1952 strncpy(tmp_tfm->cipher_name, cipher_name,
1952 ECRYPTFS_MAX_CIPHER_NAME_SIZE); 1953 ECRYPTFS_MAX_CIPHER_NAME_SIZE);
1953 tmp_tfm->key_size = key_size; 1954 tmp_tfm->key_size = key_size;
1954 if ((rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm, 1955 rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
1955 tmp_tfm->cipher_name, 1956 tmp_tfm->cipher_name,
1956 &tmp_tfm->key_size))) { 1957 &tmp_tfm->key_size);
1958 if (rc) {
1957 printk(KERN_ERR "Error attempting to initialize key TFM " 1959 printk(KERN_ERR "Error attempting to initialize key TFM "
1958 "cipher with name = [%s]; rc = [%d]\n", 1960 "cipher with name = [%s]; rc = [%d]\n",
1959 tmp_tfm->cipher_name, rc); 1961 tmp_tfm->cipher_name, rc);
@@ -1988,7 +1990,8 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
1988 } 1990 }
1989 } 1991 }
1990 mutex_unlock(&key_tfm_list_mutex); 1992 mutex_unlock(&key_tfm_list_mutex);
1991 if ((rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0))) { 1993 rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0);
1994 if (rc) {
1992 printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n", 1995 printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n",
1993 rc); 1996 rc);
1994 goto out; 1997 goto out;