lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 27 Mar 2016 10:02:46 +0200
From:	Sedat Dilek <sedat.dilek@...il.com>
To:	"Theodore Ts'o" <tytso@....edu>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>,
	David Howells <dhowells@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Linux Filesystem Development List 
	<linux-fsdevel@...r.kernel.org>, jaegeuk@...nel.org,
	stable@...r.kernel.org
Subject: Re: [PATCH 5/5] ext4 crypto: use dget_parent() in ext4_d_revalidate()

On Sat, Mar 26, 2016 at 10:10 PM, Theodore Ts'o <tytso@....edu> wrote:
> This avoids potential problems caused by a race where the inode gets
> renamed out from its parent directory and the parent directory is
> deleted while ext4_d_revalidate() is running.
>
> Fixes: 28b4c263961c

Full Fixes-tag...

Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or
removing the key")

> Reported-by: Al Viro <viro@...IV.linux.org.uk>
> Signed-off-by: Theodore Ts'o <tytso@....edu>
> Cc: stable@...r.kernel.org

This for Linux v4.6(-rc1+) ?

- Sedat -

> ---
>  fs/ext4/crypto.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
> index 012fd32..ea69ce4 100644
> --- a/fs/ext4/crypto.c
> +++ b/fs/ext4/crypto.c
> @@ -478,13 +478,16 @@ uint32_t ext4_validate_encryption_key_size(uint32_t mode, uint32_t size)
>   */
>  static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)
>  {
> -       struct inode *dir = d_inode(dentry->d_parent);
> -       struct ext4_crypt_info *ci = EXT4_I(dir)->i_crypt_info;
> +       struct dentry *dir;
> +       struct ext4_crypt_info *ci;
>         int dir_has_key, cached_with_key;
>
> -       if (!ext4_encrypted_inode(dir))
> +       dir = dget_parent(dentry);
> +       if (!ext4_encrypted_inode(d_inode(dir))) {
> +               dput(dir);
>                 return 0;
> -
> +       }
> +       ci = EXT4_I(d_inode(dir))->i_crypt_info;
>         if (ci && ci->ci_keyring_key &&
>             (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
>                                           (1 << KEY_FLAG_REVOKED) |
> @@ -494,6 +497,7 @@ static int ext4_d_revalidate(struct dentry *dentry, unsigned int flags)
>         /* this should eventually be an flag in d_flags */
>         cached_with_key = dentry->d_fsdata != NULL;
>         dir_has_key = (ci != NULL);
> +       dput(dir);
>
>         /*
>          * If the dentry was cached without the key, and it is a
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ