linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: crypto return correct error for file_mmap when get_encryption_info failed.
@ 2015-11-01 22:01 Xu Cang
  2015-11-02  0:32 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Cang @ 2015-11-01 22:01 UTC (permalink / raw)
  To: linux-ext4

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;
        }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: crypto return correct error for file_mmap when get_encryption_info failed.
  2015-11-01 22:01 [PATCH] ext4: crypto return correct error for file_mmap when get_encryption_info failed Xu Cang
@ 2015-11-02  0:32 ` Darrick J. Wong
  2015-11-02 20:26   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2015-11-02  0:32 UTC (permalink / raw)
  To: Xu Cang; +Cc: linux-ext4

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: crypto return correct error for file_mmap when get_encryption_info failed.
  2015-11-02  0:32 ` Darrick J. Wong
@ 2015-11-02 20:26   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2015-11-02 20:26 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Xu Cang, linux-ext4

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-02 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01 22:01 [PATCH] ext4: crypto return correct error for file_mmap when get_encryption_info failed Xu Cang
2015-11-02  0:32 ` Darrick J. Wong
2015-11-02 20:26   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).