aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-11 08:01:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-11 08:01:27 -0400
commiteca9fdf32dd48976eab18d310acb0b8d4cc9bf26 (patch)
tree54d6e8fd0fb3bb69a012953dbb180bdcb11d9822 /fs/ecryptfs
parent41e46ac0fae9583d81e6b148329fec627d192181 (diff)
parent0f9e2bf008a1b143973a01b52320eb66c20ac6ab (diff)
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
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/file.c4
-rw-r--r--fs/ecryptfs/inode.c25
-rw-r--r--fs/ecryptfs/keystore.c2
-rw-r--r--fs/ecryptfs/messaging.c3
4 files changed, 11 insertions, 23 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index db0fad3269c0..b4b6ab9873ae 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -229,8 +229,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
229 if (rc) { 229 if (rc) {
230 printk(KERN_ERR "%s: Error attempting to initialize " 230 printk(KERN_ERR "%s: Error attempting to initialize "
231 "the lower file for the dentry with name " 231 "the lower file for the dentry with name "
232 "[%s]; rc = [%d]\n", __func__, 232 "[%pd]; rc = [%d]\n", __func__,
233 ecryptfs_dentry->d_name.name, rc); 233 ecryptfs_dentry, rc);
234 goto out_free; 234 goto out_free;
235 } 235 }
236 if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) 236 if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index d4a9431ec73c..1686dc2da9fd 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -53,9 +53,7 @@ static void unlock_dir(struct dentry *dir)
53 53
54static int ecryptfs_inode_test(struct inode *inode, void *lower_inode) 54static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
55{ 55{
56 if (ecryptfs_inode_to_lower(inode) == (struct inode *)lower_inode) 56 return ecryptfs_inode_to_lower(inode) == lower_inode;
57 return 1;
58 return 0;
59} 57}
60 58
61static int ecryptfs_inode_set(struct inode *inode, void *opaque) 59static int ecryptfs_inode_set(struct inode *inode, void *opaque)
@@ -192,12 +190,6 @@ ecryptfs_do_create(struct inode *directory_inode,
192 190
193 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 191 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
194 lower_dir_dentry = lock_parent(lower_dentry); 192 lower_dir_dentry = lock_parent(lower_dentry);
195 if (IS_ERR(lower_dir_dentry)) {
196 ecryptfs_printk(KERN_ERR, "Error locking directory of "
197 "dentry\n");
198 inode = ERR_CAST(lower_dir_dentry);
199 goto out;
200 }
201 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true); 193 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true);
202 if (rc) { 194 if (rc) {
203 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 195 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
@@ -215,7 +207,6 @@ ecryptfs_do_create(struct inode *directory_inode,
215 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); 207 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
216out_lock: 208out_lock:
217 unlock_dir(lower_dir_dentry); 209 unlock_dir(lower_dir_dentry);
218out:
219 return inode; 210 return inode;
220} 211}
221 212
@@ -250,8 +241,8 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
250 if (rc) { 241 if (rc) {
251 printk(KERN_ERR "%s: Error attempting to initialize " 242 printk(KERN_ERR "%s: Error attempting to initialize "
252 "the lower file for the dentry with name " 243 "the lower file for the dentry with name "
253 "[%s]; rc = [%d]\n", __func__, 244 "[%pd]; rc = [%d]\n", __func__,
254 ecryptfs_dentry->d_name.name, rc); 245 ecryptfs_dentry, rc);
255 goto out; 246 goto out;
256 } 247 }
257 rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode); 248 rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode);
@@ -313,8 +304,8 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode)
313 if (rc) { 304 if (rc) {
314 printk(KERN_ERR "%s: Error attempting to initialize " 305 printk(KERN_ERR "%s: Error attempting to initialize "
315 "the lower file for the dentry with name " 306 "the lower file for the dentry with name "
316 "[%s]; rc = [%d]\n", __func__, 307 "[%pd]; rc = [%d]\n", __func__,
317 dentry->d_name.name, rc); 308 dentry, rc);
318 return rc; 309 return rc;
319 } 310 }
320 311
@@ -418,8 +409,8 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
418 if (IS_ERR(lower_dentry)) { 409 if (IS_ERR(lower_dentry)) {
419 rc = PTR_ERR(lower_dentry); 410 rc = PTR_ERR(lower_dentry);
420 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " 411 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
421 "[%d] on lower_dentry = [%s]\n", __func__, rc, 412 "[%d] on lower_dentry = [%pd]\n", __func__, rc,
422 ecryptfs_dentry->d_name.name); 413 ecryptfs_dentry);
423 goto out; 414 goto out;
424 } 415 }
425 if (lower_dentry->d_inode) 416 if (lower_dentry->d_inode)
@@ -1039,7 +1030,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1039 } 1030 }
1040 1031
1041 rc = vfs_setxattr(lower_dentry, name, value, size, flags); 1032 rc = vfs_setxattr(lower_dentry, name, value, size, flags);
1042 if (!rc) 1033 if (!rc && dentry->d_inode)
1043 fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode); 1034 fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode);
1044out: 1035out:
1045 return rc; 1036 return rc;
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 4725a07f003c..635e8e16a5b7 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/syscalls.h>
30#include <linux/pagemap.h> 29#include <linux/pagemap.h>
31#include <linux/key.h> 30#include <linux/key.h>
32#include <linux/random.h> 31#include <linux/random.h>
@@ -1846,7 +1845,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
1846 "(Tag 11 not allowed by itself)\n"); 1845 "(Tag 11 not allowed by itself)\n");
1847 rc = -EIO; 1846 rc = -EIO;
1848 goto out_wipe_list; 1847 goto out_wipe_list;
1849 break;
1850 default: 1848 default:
1851 ecryptfs_printk(KERN_DEBUG, "No packet at offset [%zd] " 1849 ecryptfs_printk(KERN_DEBUG, "No packet at offset [%zd] "
1852 "of the file header; hex value of " 1850 "of the file header; hex value of "
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index e57380e5f6bd..286f10b0363b 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -434,8 +434,7 @@ void ecryptfs_release_messaging(void)
434 mutex_lock(&ecryptfs_msg_ctx_lists_mux); 434 mutex_lock(&ecryptfs_msg_ctx_lists_mux);
435 for (i = 0; i < ecryptfs_message_buf_len; i++) { 435 for (i = 0; i < ecryptfs_message_buf_len; i++) {
436 mutex_lock(&ecryptfs_msg_ctx_arr[i].mux); 436 mutex_lock(&ecryptfs_msg_ctx_arr[i].mux);
437 if (ecryptfs_msg_ctx_arr[i].msg) 437 kfree(ecryptfs_msg_ctx_arr[i].msg);
438 kfree(ecryptfs_msg_ctx_arr[i].msg);
439 mutex_unlock(&ecryptfs_msg_ctx_arr[i].mux); 438 mutex_unlock(&ecryptfs_msg_ctx_arr[i].mux);
440 } 439 }
441 kfree(ecryptfs_msg_ctx_arr); 440 kfree(ecryptfs_msg_ctx_arr);