Minor code cleanups and a fix for when eCryptfs metadata is stored in xattrs
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCgAGBQJUNtXXAAoJENaSAD2qAscKx1UP/jqt4gm1AYFBpkwBhVRUssIQ wHckk8QPasIdEGeKvyCKXl88sUDLSsJwf/mUpl8pBfKm64LokP2fmUBU9Pkf9hVU lcuaFNIEmHh8p1IqcfaFbnZOjuuHc9M2ULQLmo5ShoTHNu6JYAP2zRBMfFrEdcMR vKh+RCARa5jr1CdwTHX+dH5vJQIQXW/qgRK5G5Z6KeBI766jK2BvZxYHivUgLWuC dV6K4RzvHHJYEVoXjCUhrgGepGwHlDoEgx/Y0GK9vbFPG38IrfSlN6fgvzV6mMYE ien8FsuHPv5oiBmFM2byRmWpJtWUOViCbMaMmKqY5Ix21E0lUafA7ixH3nSpOHNZ b29dxmHnEDomCJXLAF0NQUE84yTw6ITLp2FldUR2o+sidnJsDx/hph/KvmsK6d6P sDfEN/DtzPluZoXKY0jrRtoAhi0citNTgKfrujmx6baBstxRp7AfwGcP4skXJq7w wkg0Seo449CUaBJK9A4s7nIjMBQ6/3hjvF/NVcry1aY+/RyhJDz6uFrtnOEqW3So 6khwJOOcRkmLLXrk+DzvthDRCVNJhWM80cB5/UBBfVG2Kk3PHa86Jfp5Y4teWugx zyoacEWiitKcK4Po8skZpLd2vUwny/cD0qS43LT+SMvgRsYZ4XdUnceoY8FkOnLr ooIFKHCR/+2XVnAaC101 =mjS7 -----END PGP SIGNATURE----- Merge tag 'ecryptfs-3.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs Pull eCryptfs updates from Tyler Hicks: "Minor code cleanups and a fix for when eCryptfs metadata is stored in xattrs" * tag 'ecryptfs-3.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs: ecryptfs: remove unneeded buggy code in ecryptfs_do_create() ecryptfs: avoid to access NULL pointer when write metadata in xattr ecryptfs: remove unnecessary break after goto ecryptfs: Remove unnecessary include of syscall.h in keystore.c fs/ecryptfs/messaging.c: remove null test before kfree ecryptfs: Drop cast Use %pd in eCryptFS
This commit is contained in:
commit
eca9fdf32d
|
@ -229,8 +229,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
|
|||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error attempting to initialize "
|
||||
"the lower file for the dentry with name "
|
||||
"[%s]; rc = [%d]\n", __func__,
|
||||
ecryptfs_dentry->d_name.name, rc);
|
||||
"[%pd]; rc = [%d]\n", __func__,
|
||||
ecryptfs_dentry, rc);
|
||||
goto out_free;
|
||||
}
|
||||
if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
|
||||
|
|
|
@ -53,9 +53,7 @@ static void unlock_dir(struct dentry *dir)
|
|||
|
||||
static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
|
||||
{
|
||||
if (ecryptfs_inode_to_lower(inode) == (struct inode *)lower_inode)
|
||||
return 1;
|
||||
return 0;
|
||||
return ecryptfs_inode_to_lower(inode) == lower_inode;
|
||||
}
|
||||
|
||||
static int ecryptfs_inode_set(struct inode *inode, void *opaque)
|
||||
|
@ -192,12 +190,6 @@ ecryptfs_do_create(struct inode *directory_inode,
|
|||
|
||||
lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
|
||||
lower_dir_dentry = lock_parent(lower_dentry);
|
||||
if (IS_ERR(lower_dir_dentry)) {
|
||||
ecryptfs_printk(KERN_ERR, "Error locking directory of "
|
||||
"dentry\n");
|
||||
inode = ERR_CAST(lower_dir_dentry);
|
||||
goto out;
|
||||
}
|
||||
rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
|
||||
|
@ -215,7 +207,6 @@ ecryptfs_do_create(struct inode *directory_inode,
|
|||
fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
|
||||
out_lock:
|
||||
unlock_dir(lower_dir_dentry);
|
||||
out:
|
||||
return inode;
|
||||
}
|
||||
|
||||
|
@ -250,8 +241,8 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
|
|||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error attempting to initialize "
|
||||
"the lower file for the dentry with name "
|
||||
"[%s]; rc = [%d]\n", __func__,
|
||||
ecryptfs_dentry->d_name.name, rc);
|
||||
"[%pd]; rc = [%d]\n", __func__,
|
||||
ecryptfs_dentry, rc);
|
||||
goto out;
|
||||
}
|
||||
rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode);
|
||||
|
@ -313,8 +304,8 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode)
|
|||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error attempting to initialize "
|
||||
"the lower file for the dentry with name "
|
||||
"[%s]; rc = [%d]\n", __func__,
|
||||
dentry->d_name.name, rc);
|
||||
"[%pd]; rc = [%d]\n", __func__,
|
||||
dentry, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -418,8 +409,8 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
|
|||
if (IS_ERR(lower_dentry)) {
|
||||
rc = PTR_ERR(lower_dentry);
|
||||
ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
|
||||
"[%d] on lower_dentry = [%s]\n", __func__, rc,
|
||||
ecryptfs_dentry->d_name.name);
|
||||
"[%d] on lower_dentry = [%pd]\n", __func__, rc,
|
||||
ecryptfs_dentry);
|
||||
goto out;
|
||||
}
|
||||
if (lower_dentry->d_inode)
|
||||
|
@ -1039,7 +1030,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
|
|||
}
|
||||
|
||||
rc = vfs_setxattr(lower_dentry, name, value, size, flags);
|
||||
if (!rc)
|
||||
if (!rc && dentry->d_inode)
|
||||
fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode);
|
||||
out:
|
||||
return rc;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
*/
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/key.h>
|
||||
#include <linux/random.h>
|
||||
|
@ -1846,7 +1845,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
|
|||
"(Tag 11 not allowed by itself)\n");
|
||||
rc = -EIO;
|
||||
goto out_wipe_list;
|
||||
break;
|
||||
default:
|
||||
ecryptfs_printk(KERN_DEBUG, "No packet at offset [%zd] "
|
||||
"of the file header; hex value of "
|
||||
|
|
|
@ -434,8 +434,7 @@ void ecryptfs_release_messaging(void)
|
|||
mutex_lock(&ecryptfs_msg_ctx_lists_mux);
|
||||
for (i = 0; i < ecryptfs_message_buf_len; i++) {
|
||||
mutex_lock(&ecryptfs_msg_ctx_arr[i].mux);
|
||||
if (ecryptfs_msg_ctx_arr[i].msg)
|
||||
kfree(ecryptfs_msg_ctx_arr[i].msg);
|
||||
kfree(ecryptfs_msg_ctx_arr[i].msg);
|
||||
mutex_unlock(&ecryptfs_msg_ctx_arr[i].mux);
|
||||
}
|
||||
kfree(ecryptfs_msg_ctx_arr);
|
||||
|
|
Loading…
Reference in New Issue
Block a user