diff mbox

ext4: crypto return correct error for file_mmap when get_encryption_info failed.

Message ID CAOjcEBL6QQYdSpVq_6mSuzyMq6XO6kJGhseF6bD3WOeYLgC6Vw@mail.gmail.com
State New, archived
Headers show

Commit Message

Xu Cang Nov. 1, 2015, 10:01 p.m. UTC
}
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick Wong Nov. 2, 2015, 12:32 a.m. UTC | #1
On Sun, Nov 01, 2015 at 05:01:37PM -0500, Xu Cang wrote:
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 113837e..1c0086a 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -295,7 +295,7 @@ static int ext4_file_mmap(struct file *file,
> struct vm_area_struct *vma)
>         if (ext4_encrypted_inode(inode)) {
>                 int err = ext4_get_encryption_info(inode);
>                 if (err)
> -                       return 0;
> +                       return -EACCES;

Shouldn't this return err here?

--D

>                 if (ext4_encryption_info(inode) == NULL)
>                         return -ENOKEY;
>         }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Nov. 2, 2015, 8:26 p.m. UTC | #2
On Sun, Nov 01, 2015 at 04:32:35PM -0800, Darrick J. Wong wrote:
> On Sun, Nov 01, 2015 at 05:01:37PM -0500, Xu Cang wrote:
> > diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> > index 113837e..1c0086a 100644
> > --- a/fs/ext4/file.c
> > +++ b/fs/ext4/file.c
> > @@ -295,7 +295,7 @@ static int ext4_file_mmap(struct file *file,
> > struct vm_area_struct *vma)
> >         if (ext4_encrypted_inode(inode)) {
> >                 int err = ext4_get_encryption_info(inode);
> >                 if (err)
> > -                       return 0;
> > +                       return -EACCES;
> 
> Shouldn't this return err here?

Yes, it should return err here.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 113837e..1c0086a 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -295,7 +295,7 @@  static int ext4_file_mmap(struct file *file,
struct vm_area_struct *vma)
        if (ext4_encrypted_inode(inode)) {
                int err = ext4_get_encryption_info(inode);
                if (err)
-                       return 0;
+                       return -EACCES;
                if (ext4_encryption_info(inode) == NULL)
                        return -ENOKEY;