Skip to content

Commit 682a8e2

Browse files
committed
Merge tag 'ecryptfs-5.13-rc1-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
Pull ecryptfs updates from Tyler Hicks: "Code cleanups and a bug fix - W=1 compiler warning cleanups - Mutex initialization simplification - Protect against NULL pointer exception during mount" * tag 'ecryptfs-5.13-rc1-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs: ecryptfs: fix kernel panic with null dev_name ecryptfs: remove unused helpers ecryptfs: Fix typo in message eCryptfs: Use DEFINE_MUTEX() for mutex lock ecryptfs: keystore: Fix some kernel-doc issues and demote non-conformant headers ecryptfs: inode: Help out nearly-there header and demote non-conformant ones ecryptfs: mmap: Help out one function header and demote other abuses ecryptfs: crypto: Supply some missing param descriptions and demote abuses ecryptfs: miscdev: File headers are not good kernel-doc candidates ecryptfs: main: Demote a bunch of non-conformant kernel-doc headers ecryptfs: messaging: Add missing param descriptions and demote abuses ecryptfs: super: Fix formatting, naming and kernel-doc abuses ecryptfs: file: Demote kernel-doc abuses ecryptfs: kthread: Demote file header and provide description for 'cred' ecryptfs: dentry: File headers are not good candidates for kernel-doc ecryptfs: debug: Demote a couple of kernel-doc abuses ecryptfs: read_write: File headers do not make good candidates for kernel-doc ecryptfs: use DEFINE_MUTEX() for mutex lock eCryptfs: add a semicolon
2 parents 7ec901b + 9046625 commit 682a8e2

File tree

14 files changed

+73
-63
lines changed

14 files changed

+73
-63
lines changed

fs/ecryptfs/crypto.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 1997-2004 Erez Zadok
@@ -350,7 +350,7 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
350350
return rc;
351351
}
352352

353-
/**
353+
/*
354354
* lower_offset_for_page
355355
*
356356
* Convert an eCryptfs page index into a lower byte offset
@@ -535,7 +535,7 @@ int ecryptfs_decrypt_page(struct page *page)
535535
rc = crypt_extent(crypt_stat, page, page,
536536
extent_offset, DECRYPT);
537537
if (rc) {
538-
printk(KERN_ERR "%s: Error encrypting extent; "
538+
printk(KERN_ERR "%s: Error decrypting extent; "
539539
"rc = [%d]\n", __func__, rc);
540540
goto out;
541541
}
@@ -627,9 +627,8 @@ void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat)
627627
}
628628
}
629629

630-
/**
630+
/*
631631
* ecryptfs_compute_root_iv
632-
* @crypt_stats
633632
*
634633
* On error, sets the root IV to all 0's.
635634
*/
@@ -1370,7 +1369,7 @@ int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry,
13701369
return rc;
13711370
}
13721371

1373-
/**
1372+
/*
13741373
* ecryptfs_read_metadata
13751374
*
13761375
* Common entry point for reading file metadata. From here, we could
@@ -1448,7 +1447,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
14481447
return rc;
14491448
}
14501449

1451-
/**
1450+
/*
14521451
* ecryptfs_encrypt_filename - encrypt filename
14531452
*
14541453
* CBC-encrypts the filename. We do not want to encrypt the same
@@ -1590,11 +1589,10 @@ ecryptfs_process_key_cipher(struct crypto_skcipher **key_tfm,
15901589

15911590
struct kmem_cache *ecryptfs_key_tfm_cache;
15921591
static struct list_head key_tfm_list;
1593-
struct mutex key_tfm_list_mutex;
1592+
DEFINE_MUTEX(key_tfm_list_mutex);
15941593

15951594
int __init ecryptfs_init_crypto(void)
15961595
{
1597-
mutex_init(&key_tfm_list_mutex);
15981596
INIT_LIST_HEAD(&key_tfm_list);
15991597
return 0;
16001598
}
@@ -1877,10 +1875,11 @@ ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
18771875

18781876
/**
18791877
* ecryptfs_encrypt_and_encode_filename - converts a plaintext file name to cipher text
1880-
* @crypt_stat: The crypt_stat struct associated with the file anem to encode
1878+
* @encoded_name: The encrypted name
1879+
* @encoded_name_size: Length of the encrypted name
1880+
* @mount_crypt_stat: The crypt_stat struct associated with the file name to encode
18811881
* @name: The plaintext name
1882-
* @length: The length of the plaintext
1883-
* @encoded_name: The encypted name
1882+
* @name_size: The length of the plaintext name
18841883
*
18851884
* Encrypts and encodes a filename into something that constitutes a
18861885
* valid filename for a filesystem, with printable characters.
@@ -1992,7 +1991,7 @@ static bool is_dot_dotdot(const char *name, size_t name_size)
19921991
* ecryptfs_decode_and_decrypt_filename - converts the encoded cipher text name to decoded plaintext
19931992
* @plaintext_name: The plaintext name
19941993
* @plaintext_name_size: The plaintext name size
1995-
* @ecryptfs_dir_dentry: eCryptfs directory dentry
1994+
* @sb: Ecryptfs's super_block
19961995
* @name: The filename in cipher text
19971996
* @name_size: The cipher text name size
19981997
*

fs/ecryptfs/debug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
* Functions only useful for debugging.
55
*
@@ -9,7 +9,7 @@
99

1010
#include "ecryptfs_kernel.h"
1111

12-
/**
12+
/*
1313
* ecryptfs_dump_auth_tok - debug function to print auth toks
1414
*
1515
* This function will print the contents of an ecryptfs authentication

fs/ecryptfs/dentry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 1997-2003 Erez Zadok

fs/ecryptfs/ecryptfs_kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ ecryptfs_dentry_to_lower_path(struct dentry *dentry)
513513
}
514514

515515
#define ecryptfs_printk(type, fmt, arg...) \
516-
__ecryptfs_printk(type "%s: " fmt, __func__, ## arg);
516+
__ecryptfs_printk(type "%s: " fmt, __func__, ## arg)
517517
__printf(1, 2)
518518
void __ecryptfs_printk(const char *fmt, ...);
519519

fs/ecryptfs/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 1997-2004 Erez Zadok
@@ -19,7 +19,7 @@
1919
#include <linux/fs_stack.h>
2020
#include "ecryptfs_kernel.h"
2121

22-
/**
22+
/*
2323
* ecryptfs_read_update_atime
2424
*
2525
* generic_file_read updates the atime of upper layer inode. But, it

fs/ecryptfs/inode.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 1997-2004 Erez Zadok
@@ -199,7 +199,7 @@ ecryptfs_do_create(struct inode *directory_inode,
199199
return inode;
200200
}
201201

202-
/**
202+
/*
203203
* ecryptfs_initialize_file
204204
*
205205
* Cause the file to be changed from a basic empty file to an ecryptfs
@@ -242,10 +242,8 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
242242
return rc;
243243
}
244244

245-
/**
245+
/*
246246
* ecryptfs_create
247-
* @dir: The inode of the directory in which to create the file.
248-
* @dentry: The eCryptfs dentry
249247
* @mode: The mode of the new file.
250248
*
251249
* Creates a new file.
@@ -313,7 +311,7 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode)
313311
return 0;
314312
}
315313

316-
/**
314+
/*
317315
* ecryptfs_lookup_interpose - Dentry interposition for a lookup
318316
*/
319317
static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
@@ -873,6 +871,7 @@ ecryptfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
873871

874872
/**
875873
* ecryptfs_setattr
874+
* @mnt_userns: user namespace of the target mount
876875
* @dentry: dentry handle to the inode to modify
877876
* @ia: Structure with flags of what to change and values
878877
*

fs/ecryptfs/keystore.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
* In-kernel key management code. Includes functions to parse and
55
* write authentication token-related packets with the underlying
@@ -21,7 +21,7 @@
2121
#include <linux/slab.h>
2222
#include "ecryptfs_kernel.h"
2323

24-
/**
24+
/*
2525
* request_key returned an error instead of a valid key address;
2626
* determine the type of error, make appropriate log entries, and
2727
* return an error code.
@@ -536,8 +536,9 @@ ecryptfs_find_global_auth_tok_for_sig(
536536

537537
/**
538538
* ecryptfs_find_auth_tok_for_sig
539+
* @auth_tok_key: key containing the authentication token
539540
* @auth_tok: Set to the matching auth_tok; NULL if not found
540-
* @crypt_stat: inode crypt_stat crypto context
541+
* @mount_crypt_stat: inode crypt_stat crypto context
541542
* @sig: Sig of auth_tok to find
542543
*
543544
* For now, this function simply looks at the registered auth_tok's
@@ -576,7 +577,7 @@ ecryptfs_find_auth_tok_for_sig(
576577
return rc;
577578
}
578579

579-
/**
580+
/*
580581
* write_tag_70_packet can gobble a lot of stack space. We stuff most
581582
* of the function's parameters in a kmalloc'd struct to help reduce
582583
* eCryptfs' overall stack usage.
@@ -604,7 +605,7 @@ struct ecryptfs_write_tag_70_packet_silly_stack {
604605
struct shash_desc *hash_desc;
605606
};
606607

607-
/**
608+
/*
608609
* write_tag_70_packet - Write encrypted filename (EFN) packet against FNEK
609610
* @filename: NULL-terminated filename string
610611
*
@@ -873,7 +874,7 @@ struct ecryptfs_parse_tag_70_packet_silly_stack {
873874
};
874875

875876
/**
876-
* parse_tag_70_packet - Parse and process FNEK-encrypted passphrase packet
877+
* ecryptfs_parse_tag_70_packet - Parse and process FNEK-encrypted passphrase packet
877878
* @filename: This function kmalloc's the memory for the filename
878879
* @filename_size: This function sets this to the amount of memory
879880
* kmalloc'd for the filename
@@ -1172,7 +1173,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
11721173
rc = ecryptfs_cipher_code_to_string(crypt_stat->cipher, cipher_code);
11731174
if (rc) {
11741175
ecryptfs_printk(KERN_ERR, "Cipher code [%d] is invalid\n",
1175-
cipher_code)
1176+
cipher_code);
11761177
goto out;
11771178
}
11781179
crypt_stat->flags |= ECRYPTFS_KEY_VALID;

fs/ecryptfs/kthread.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 2008 International Business Machines Corp.
@@ -108,6 +108,7 @@ void ecryptfs_destroy_kthread(void)
108108
* @lower_file: Result of dentry_open by root on lower dentry
109109
* @lower_dentry: Lower dentry for file to open
110110
* @lower_mnt: Lower vfsmount for file to open
111+
* @cred: credential to use for this call
111112
*
112113
* This function gets a r/w file opened against the lower dentry.
113114
*

fs/ecryptfs/main.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
2-
/**
2+
/*
33
* eCryptfs: Linux filesystem encryption layer
44
*
55
* Copyright (C) 1997-2003 Erez Zadok
@@ -24,7 +24,7 @@
2424
#include <linux/magic.h>
2525
#include "ecryptfs_kernel.h"
2626

27-
/**
27+
/*
2828
* Module parameter that defines the ecryptfs_verbosity level.
2929
*/
3030
int ecryptfs_verbosity = 0;
@@ -34,7 +34,7 @@ MODULE_PARM_DESC(ecryptfs_verbosity,
3434
"Initial verbosity level (0 or 1; defaults to "
3535
"0, which is Quiet)");
3636

37-
/**
37+
/*
3838
* Module parameter that defines the number of message buffer elements
3939
*/
4040
unsigned int ecryptfs_message_buf_len = ECRYPTFS_DEFAULT_MSG_CTX_ELEMS;
@@ -43,7 +43,7 @@ module_param(ecryptfs_message_buf_len, uint, 0);
4343
MODULE_PARM_DESC(ecryptfs_message_buf_len,
4444
"Number of message buffer elements");
4545

46-
/**
46+
/*
4747
* Module parameter that defines the maximum guaranteed amount of time to wait
4848
* for a response from ecryptfsd. The actual sleep time will be, more than
4949
* likely, a small amount greater than this specified value, but only less if
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(ecryptfs_message_wait_timeout,
5757
"sleep while waiting for a message response from "
5858
"userspace");
5959

60-
/**
60+
/*
6161
* Module parameter that is an estimate of the maximum number of users
6262
* that will be concurrently using eCryptfs. Set this to the right
6363
* value to balance performance and memory use.
@@ -80,7 +80,7 @@ void __ecryptfs_printk(const char *fmt, ...)
8080
va_end(args);
8181
}
8282

83-
/**
83+
/*
8484
* ecryptfs_init_lower_file
8585
* @ecryptfs_dentry: Fully initialized eCryptfs dentry object, with
8686
* the lower dentry and the lower mount set
@@ -221,7 +221,7 @@ static void ecryptfs_init_mount_crypt_stat(
221221

222222
/**
223223
* ecryptfs_parse_options
224-
* @sb: The ecryptfs super block
224+
* @sbi: The ecryptfs super block
225225
* @options: The options passed to the kernel
226226
* @check_ruid: set to 1 if device uid should be checked against the ruid
227227
*
@@ -466,10 +466,10 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
466466
struct kmem_cache *ecryptfs_sb_info_cache;
467467
static struct file_system_type ecryptfs_fs_type;
468468

469-
/**
470-
* ecryptfs_get_sb
471-
* @fs_type
472-
* @flags
469+
/*
470+
* ecryptfs_mount
471+
* @fs_type: The filesystem type that the superblock should belong to
472+
* @flags: The flags associated with the mount
473473
* @dev_name: The path to mount over
474474
* @raw_data: The options passed into the kernel
475475
*/
@@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
492492
goto out;
493493
}
494494

495+
if (!dev_name) {
496+
rc = -EINVAL;
497+
err = "Device name cannot be null";
498+
goto out;
499+
}
500+
495501
rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid);
496502
if (rc) {
497503
err = "Error parsing options";
@@ -635,7 +641,7 @@ static struct file_system_type ecryptfs_fs_type = {
635641
};
636642
MODULE_ALIAS_FS("ecryptfs");
637643

638-
/**
644+
/*
639645
* inode_info_init_once
640646
*
641647
* Initializes the ecryptfs_inode_info_cache when it is created

0 commit comments

Comments
 (0)