Message ID | 1432082606-55975-3-git-send-email-jaegeuk@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, May 19, 2015 at 05:43:25PM -0700, Jaegeuk Kim wrote:
> This patch adds to check encryption for tmpfile in early stage.
Don't you also need a call to ext4_inherit_context(dir, inode) here?
(I need to fix this for ext4 as well).
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 20, 2015 at 12:46:04AM -0400, Theodore Ts'o wrote: > On Tue, May 19, 2015 at 05:43:25PM -0700, Jaegeuk Kim wrote: > > This patch adds to check encryption for tmpfile in early stage. > > Don't you also need a call to ext4_inherit_context(dir, inode) here? > (I need to fix this for ext4 as well). Actually this should be: err = f2fs_get_encryption_info(inode); <- for inode. if (err) goto out; In f2fs, f2fs_do_tmpfile calls f2fs_inherit_context already. :) > > - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, May 19, 2015 at 10:01:25PM -0700, Jaegeuk Kim wrote: > On Wed, May 20, 2015 at 12:46:04AM -0400, Theodore Ts'o wrote: > > On Tue, May 19, 2015 at 05:43:25PM -0700, Jaegeuk Kim wrote: > > > This patch adds to check encryption for tmpfile in early stage. > > > > Don't you also need a call to ext4_inherit_context(dir, inode) here? > > (I need to fix this for ext4 as well). > > Actually this should be: > > err = f2fs_get_encryption_info(inode); <- for inode. > if (err) > goto out; Sorry Ted, Please ignore the above; dir was correct. > > In f2fs, f2fs_do_tmpfile calls f2fs_inherit_context already. :) > > > > > - Ted > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Wednesday, May 20, 2015 8:43 AM > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Cc: Jaegeuk Kim > Subject: [f2fs-dev] [PATCH 3/4] f2fs crypto: check encryption for tmpfile > > This patch adds to check encryption for tmpfile in early stage. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > fs/f2fs/namei.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > index dded2b0..47066b0 100644 > --- a/fs/f2fs/namei.c > +++ b/fs/f2fs/namei.c > @@ -531,6 +531,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry, > } > > f2fs_lock_op(sbi); > + > + err = f2fs_get_encryption_info(dir); > + if (err) > + goto out; > + > err = acquire_orphan_inode(sbi); > if (err) > goto out; > -- > 2.1.1 I can't find the original thread, so I reply here. Merged patch in dev branch shows that our code is modified as below: static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) { + int err = f2fs_get_encryption_info(dir); + if (err) + return err; + return __f2fs_tmpfile(dir, dentry, mode, NULL); } It seems that, if we try to make a temp file in an unencrypted dir, we will always fail with -ENODATA in f2fs_get_encryption_info because encryption context is not exist in xattr. So we should check dir with f2fs_encrypted_inode() before f2fs_get_encryption_info() to avoid that. Thanks, -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Chao, On Thu, May 28, 2015 at 06:20:05PM +0800, Chao Yu wrote: > Hi Jaegeuk, > > > -----Original Message----- > > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > > Sent: Wednesday, May 20, 2015 8:43 AM > > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > > linux-f2fs-devel@lists.sourceforge.net > > Cc: Jaegeuk Kim > > Subject: [f2fs-dev] [PATCH 3/4] f2fs crypto: check encryption for tmpfile > > > > This patch adds to check encryption for tmpfile in early stage. > > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > > --- > > fs/f2fs/namei.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > > index dded2b0..47066b0 100644 > > --- a/fs/f2fs/namei.c > > +++ b/fs/f2fs/namei.c > > @@ -531,6 +531,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry, > > } > > > > f2fs_lock_op(sbi); > > + > > + err = f2fs_get_encryption_info(dir); > > + if (err) > > + goto out; > > + > > err = acquire_orphan_inode(sbi); > > if (err) > > goto out; > > -- > > 2.1.1 > > I can't find the original thread, so I reply here. > Merged patch in dev branch shows that our code is modified as below: > > static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) > { > + int err = f2fs_get_encryption_info(dir); > + if (err) > + return err; > + > return __f2fs_tmpfile(dir, dentry, mode, NULL); > } > > It seems that, if we try to make a temp file in an unencrypted dir, we will > always fail with -ENODATA in f2fs_get_encryption_info because encryption > context is not exist in xattr. > > So we should check dir with f2fs_encrypted_inode() before > f2fs_get_encryption_info() to avoid that. Indeed. Will fix it up. Thanks, > > Thanks, -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index dded2b0..47066b0 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -531,6 +531,11 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry, } f2fs_lock_op(sbi); + + err = f2fs_get_encryption_info(dir); + if (err) + goto out; + err = acquire_orphan_inode(sbi); if (err) goto out;
This patch adds to check encryption for tmpfile in early stage. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/namei.c | 5 +++++ 1 file changed, 5 insertions(+)