Skip to contentSkip to conversation

ubifs: remove unnecessary calls to set up directory key

PATCH In review Eric Biggers 2 participants 3 messages Mar 15, 2019 – Apr 18, 2019

Subsystems (3)
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

PATCH 1/1 ubifs: remove unnecessary calls to set up directory key

From: Eric Biggers <[email protected]>

In ubifs_unlink() and ubifs_rmdir(), remove the call to fscrypt_get_encryption_info() that precedes fscrypt_setup_filename(). This call was unnecessary, because fscrypt_setup_filename() already tries to set up the directory's encryption key.

---
 fs/ubifs/dir.c | 12 ------------
 1 file changed, 12 deletions(-)
fs/ubifs/dir.c +0 -12
index 5767b373a8ff..c3311ea68fe5 100644
@@ -792,12 +792,6 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
 		dentry, inode->i_ino,
 		inode->i_nlink, dir->i_ino);
 
-	if (ubifs_crypt_is_encrypted(dir)) {
-		err = fscrypt_get_encryption_info(dir);
-		if (err && err != -ENOKEY)
-			return err;
-	}
-
 	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
 	if (err)
 		return err;
@@ -902,12 +896,6 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
 	if (err)
 		return err;
 
-	if (ubifs_crypt_is_encrypted(dir)) {
-		err = fscrypt_get_encryption_info(dir);
-		if (err && err != -ENOKEY)
-			return err;
-	}
-
 	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
 	if (err)
 		return err;
Signature · 1 line
2.21.0.360.g471c308f928-goog
#1 lore raw
Quoted 33 lines · Eric Biggers

From: Eric Biggers <[email protected]>

In ubifs_unlink() and ubifs_rmdir(), remove the call to fscrypt_get_encryption_info() that precedes fscrypt_setup_filename(). This call was unnecessary, because fscrypt_setup_filename() already tries to set up the directory's encryption key.

---
 fs/ubifs/dir.c | 12 ------------
 1 file changed, 12 deletions(-)
fs/ubifs/dir.c +0 -6
index 5767b373a8ff..c3311ea68fe5 100644
@@ -792,12 +792,6 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
                dentry, inode->i_ino,
                inode->i_nlink, dir->i_ino);
 
-       if (ubifs_crypt_is_encrypted(dir)) {
-               err = fscrypt_get_encryption_info(dir);
-               if (err && err != -ENOKEY)
-                       return err;
-       }
-
        err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
        if (err)
                return err;
@@ -902,12 +896,6 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
        if (err)
                return err;

fs/ubifs/dir.c static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) · line 901

Quoted 10 lines
fs/ubifs/dir.c +0 -6
 
-       if (ubifs_crypt_is_encrypted(dir)) {
-               err = fscrypt_get_encryption_info(dir);
-               if (err && err != -ENOKEY)
-                       return err;
-       }
-
        err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
        if (err)
                return err;

Thanks for the cleanup, Eric!

Signature · 2 lines
Thanks,
//richard
author maintainer
#2 lore raw
Quoted 35 lines · Richard Weinberger
Quoted 34 lines · Eric Biggers

From: Eric Biggers <[email protected]>

In ubifs_unlink() and ubifs_rmdir(), remove the call to fscrypt_get_encryption_info() that precedes fscrypt_setup_filename(). This call was unnecessary, because fscrypt_setup_filename() already tries to set up the directory's encryption key.

---
 fs/ubifs/dir.c | 12 ------------
 1 file changed, 12 deletions(-)
fs/ubifs/dir.c +0 -6
index 5767b373a8ff..c3311ea68fe5 100644
@@ -792,12 +792,6 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
                dentry, inode->i_ino,
                inode->i_nlink, dir->i_ino);
 
-       if (ubifs_crypt_is_encrypted(dir)) {
-               err = fscrypt_get_encryption_info(dir);
-               if (err && err != -ENOKEY)
-                       return err;
-       }
-
        err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
        if (err)
                return err;
@@ -902,12 +896,6 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
        if (err)
                return err;
 
Quoted 15 lines

fs/ubifs/dir.c static int ubifs_unlink(struct inode *dir, struct dentry *dentry) · line 797

Quoted 9 lines
fs/ubifs/dir.c +0 -6
-       if (ubifs_crypt_is_encrypted(dir)) {
-               err = fscrypt_get_encryption_info(dir);
-               if (err && err != -ENOKEY)
-                       return err;
-       }
-
        err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
        if (err)
                return err;

Thanks for the cleanup, Eric!

Signature · 2 lines
Thanks,
//richard

Richard, can you take this through the ubifs tree for 5.2?

- Eric