Merge tag 'fscrypt_for_linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt
Pull fscrypt updates from Ted Ts'o: "Clean up fscrypt's dcache revalidation support, and other miscellaneous cleanups" * tag 'fscrypt_for_linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt: fscrypt: cache decrypted symlink target in ->i_link vfs: use READ_ONCE() to access ->i_link fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext fscrypt: only set dentry_operations on ciphertext dentries fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory fscrypt: fix race allowing rename() and link() of ciphertext dentries fscrypt: clean up and improve dentry revalidation fscrypt: use READ_ONCE() to access ->i_crypt_info fscrypt: remove WARN_ON_ONCE() when decryption fails fscrypt: drop inode argument from fscrypt_get_ctx()
This commit is contained in:
@@ -2303,23 +2303,47 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb,
|
||||
ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
|
||||
|
||||
#ifdef CONFIG_FS_ENCRYPTION
|
||||
static inline void ext4_fname_from_fscrypt_name(struct ext4_filename *dst,
|
||||
const struct fscrypt_name *src)
|
||||
{
|
||||
memset(dst, 0, sizeof(*dst));
|
||||
|
||||
dst->usr_fname = src->usr_fname;
|
||||
dst->disk_name = src->disk_name;
|
||||
dst->hinfo.hash = src->hash;
|
||||
dst->hinfo.minor_hash = src->minor_hash;
|
||||
dst->crypto_buf = src->crypto_buf;
|
||||
}
|
||||
|
||||
static inline int ext4_fname_setup_filename(struct inode *dir,
|
||||
const struct qstr *iname,
|
||||
int lookup, struct ext4_filename *fname)
|
||||
const struct qstr *iname,
|
||||
int lookup,
|
||||
struct ext4_filename *fname)
|
||||
{
|
||||
struct fscrypt_name name;
|
||||
int err;
|
||||
|
||||
memset(fname, 0, sizeof(struct ext4_filename));
|
||||
|
||||
err = fscrypt_setup_filename(dir, iname, lookup, &name);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
fname->usr_fname = name.usr_fname;
|
||||
fname->disk_name = name.disk_name;
|
||||
fname->hinfo.hash = name.hash;
|
||||
fname->hinfo.minor_hash = name.minor_hash;
|
||||
fname->crypto_buf = name.crypto_buf;
|
||||
return err;
|
||||
ext4_fname_from_fscrypt_name(fname, &name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ext4_fname_prepare_lookup(struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
struct ext4_filename *fname)
|
||||
{
|
||||
struct fscrypt_name name;
|
||||
int err;
|
||||
|
||||
err = fscrypt_prepare_lookup(dir, dentry, &name);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ext4_fname_from_fscrypt_name(fname, &name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void ext4_fname_free_filename(struct ext4_filename *fname)
|
||||
@@ -2333,19 +2357,27 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname)
|
||||
fname->usr_fname = NULL;
|
||||
fname->disk_name.name = NULL;
|
||||
}
|
||||
#else
|
||||
#else /* !CONFIG_FS_ENCRYPTION */
|
||||
static inline int ext4_fname_setup_filename(struct inode *dir,
|
||||
const struct qstr *iname,
|
||||
int lookup, struct ext4_filename *fname)
|
||||
const struct qstr *iname,
|
||||
int lookup,
|
||||
struct ext4_filename *fname)
|
||||
{
|
||||
fname->usr_fname = iname;
|
||||
fname->disk_name.name = (unsigned char *) iname->name;
|
||||
fname->disk_name.len = iname->len;
|
||||
return 0;
|
||||
}
|
||||
static inline void ext4_fname_free_filename(struct ext4_filename *fname) { }
|
||||
|
||||
#endif
|
||||
static inline int ext4_fname_prepare_lookup(struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
struct ext4_filename *fname)
|
||||
{
|
||||
return ext4_fname_setup_filename(dir, &dentry->d_name, 1, fname);
|
||||
}
|
||||
|
||||
static inline void ext4_fname_free_filename(struct ext4_filename *fname) { }
|
||||
#endif /* !CONFIG_FS_ENCRYPTION */
|
||||
|
||||
/* dir.c */
|
||||
extern int __ext4_check_dir_entry(const char *, unsigned int, struct inode *,
|
||||
|
Reference in New Issue
Block a user