* [PATCH 1/3] f2fs crypto: check context consistent for rename2 @ 2015-05-25 10:07 Chao Yu 2015-05-28 17:07 ` Jaegeuk Kim 0 siblings, 1 reply; 4+ messages in thread From: Chao Yu @ 2015-05-25 10:07 UTC (permalink / raw) To: Jaegeuk Kim, Changman Lee; +Cc: linux-f2fs-devel, linux-kernel For exchange rename, we should check context consistent of encryption between new_dir and old_inode or old_dir and new_inode. Otherwise inheritance of parent's encryption context will be broken. Signed-off-by: Chao Yu <chao2.yu@samsung.com> --- fs/f2fs/namei.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index daed09c..3188464 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -754,6 +754,15 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, int old_nlink = 0, new_nlink = 0; int err = -ENOENT; + if ((old_dir != new_dir) && + (!f2fs_is_child_context_consistent_with_parent(new_dir, + old_inode) || + !f2fs_is_child_context_consistent_with_parent(old_dir, + new_inode))) { + err = -EPERM; + goto out; + } + f2fs_balance_fs(sbi); old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); -- 2.3.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] f2fs crypto: check context consistent for rename2 2015-05-25 10:07 [PATCH 1/3] f2fs crypto: check context consistent for rename2 Chao Yu @ 2015-05-28 17:07 ` Jaegeuk Kim 2015-05-29 2:29 ` [f2fs-dev] " Jaegeuk Kim 0 siblings, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2015-05-28 17:07 UTC (permalink / raw) To: Chao Yu; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel Hi Chao, On Mon, May 25, 2015 at 06:07:02PM +0800, Chao Yu wrote: > For exchange rename, we should check context consistent of encryption > between new_dir and old_inode or old_dir and new_inode. Otherwise > inheritance of parent's encryption context will be broken. > > Signed-off-by: Chao Yu <chao2.yu@samsung.com> > --- > fs/f2fs/namei.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > index daed09c..3188464 100644 > --- a/fs/f2fs/namei.c > +++ b/fs/f2fs/namei.c > @@ -754,6 +754,15 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, > int old_nlink = 0, new_nlink = 0; > int err = -ENOENT; > > + if ((old_dir != new_dir) && > + (!f2fs_is_child_context_consistent_with_parent(new_dir, > + old_inode) || > + !f2fs_is_child_context_consistent_with_parent(old_dir, > + new_inode))) { > + err = -EPERM; > + goto out; > + } > + Seems like we need this? --- fs/f2fs/namei.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 55d0d27..4772c14 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -756,6 +756,21 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, int old_nlink = 0, new_nlink = 0; int err = -ENOENT; + if (old_dir != new_dir) { + if (f2fs_encrypted_inode(new_dir) && + !f2fs_is_child_context_consistent_with_parent(new_dir, + old_inode)) { + err = -EPERM; + goto out; + } + if (f2fs_encrypted_inode(old_dir) && + !f2fs_is_child_context_consistent_with_parent(old_dir, + new_inode)) { + err = -EPERM; + goto out; + } + } + f2fs_balance_fs(sbi); old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); -- 2.1.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH 1/3] f2fs crypto: check context consistent for rename2 2015-05-28 17:07 ` Jaegeuk Kim @ 2015-05-29 2:29 ` Jaegeuk Kim 2015-05-29 2:54 ` Chao Yu 0 siblings, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2015-05-29 2:29 UTC (permalink / raw) To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel On Thu, May 28, 2015 at 10:07:26AM -0700, Jaegeuk Kim wrote: > Hi Chao, > > On Mon, May 25, 2015 at 06:07:02PM +0800, Chao Yu wrote: > > For exchange rename, we should check context consistent of encryption > > between new_dir and old_inode or old_dir and new_inode. Otherwise > > inheritance of parent's encryption context will be broken. > > > > Signed-off-by: Chao Yu <chao2.yu@samsung.com> > > --- > > fs/f2fs/namei.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > > index daed09c..3188464 100644 > > --- a/fs/f2fs/namei.c > > +++ b/fs/f2fs/namei.c > > @@ -754,6 +754,15 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, > > int old_nlink = 0, new_nlink = 0; > > int err = -ENOENT; > > > > + if ((old_dir != new_dir) && > > + (!f2fs_is_child_context_consistent_with_parent(new_dir, > > + old_inode) || > > + !f2fs_is_child_context_consistent_with_parent(old_dir, > > + new_inode))) { > > + err = -EPERM; > > + goto out; > > + } > > + > > Seems like we need this? > > --- > fs/f2fs/namei.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > index 55d0d27..4772c14 100644 > --- a/fs/f2fs/namei.c > +++ b/fs/f2fs/namei.c > @@ -756,6 +756,21 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, > int old_nlink = 0, new_nlink = 0; > int err = -ENOENT; > > + if (old_dir != new_dir) { > + if (f2fs_encrypted_inode(new_dir) && > + !f2fs_is_child_context_consistent_with_parent(new_dir, > + old_inode)) { > + err = -EPERM; > + goto out; > + } > + if (f2fs_encrypted_inode(old_dir) && > + !f2fs_is_child_context_consistent_with_parent(old_dir, > + new_inode)) { > + err = -EPERM; > + goto out; > + } > + } It needs to sync with ext4 patch published by Ted. Thanks, > + > f2fs_balance_fs(sbi); > > old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); > -- > 2.1.1 > > > ------------------------------------------------------------------------------ > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] f2fs crypto: check context consistent for rename2 2015-05-29 2:29 ` [f2fs-dev] " Jaegeuk Kim @ 2015-05-29 2:54 ` Chao Yu 0 siblings, 0 replies; 4+ messages in thread From: Chao Yu @ 2015-05-29 2:54 UTC (permalink / raw) To: 'Jaegeuk Kim'; +Cc: linux-kernel, linux-f2fs-devel Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Friday, May 29, 2015 10:29 AM > To: Chao Yu > Cc: linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net > Subject: Re: [f2fs-dev] [PATCH 1/3] f2fs crypto: check context consistent for rename2 > > On Thu, May 28, 2015 at 10:07:26AM -0700, Jaegeuk Kim wrote: > > Hi Chao, > > > > On Mon, May 25, 2015 at 06:07:02PM +0800, Chao Yu wrote: > > > For exchange rename, we should check context consistent of encryption > > > between new_dir and old_inode or old_dir and new_inode. Otherwise > > > inheritance of parent's encryption context will be broken. > > > > > > Signed-off-by: Chao Yu <chao2.yu@samsung.com> > > > --- > > > fs/f2fs/namei.c | 9 +++++++++ > > > 1 file changed, 9 insertions(+) > > > > > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > > > index daed09c..3188464 100644 > > > --- a/fs/f2fs/namei.c > > > +++ b/fs/f2fs/namei.c > > > @@ -754,6 +754,15 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry > *old_dentry, > > > int old_nlink = 0, new_nlink = 0; > > > int err = -ENOENT; > > > > > > + if ((old_dir != new_dir) && > > > + (!f2fs_is_child_context_consistent_with_parent(new_dir, > > > + old_inode) || > > > + !f2fs_is_child_context_consistent_with_parent(old_dir, > > > + new_inode))) { > > > + err = -EPERM; > > > + goto out; > > > + } > > > + > > > > Seems like we need this? > > > > --- > > fs/f2fs/namei.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > > index 55d0d27..4772c14 100644 > > --- a/fs/f2fs/namei.c > > +++ b/fs/f2fs/namei.c > > @@ -756,6 +756,21 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry > *old_dentry, > > int old_nlink = 0, new_nlink = 0; > > int err = -ENOENT; > > > > + if (old_dir != new_dir) { > > + if (f2fs_encrypted_inode(new_dir) && > > + !f2fs_is_child_context_consistent_with_parent(new_dir, > > + old_inode)) { > > + err = -EPERM; > > + goto out; > > + } > > + if (f2fs_encrypted_inode(old_dir) && > > + !f2fs_is_child_context_consistent_with_parent(old_dir, > > + new_inode)) { > > + err = -EPERM; > > + goto out; > > + } > > + } > > It needs to sync with ext4 patch published by Ted. No objection, please go ahead. Previously, I remove f2fs_encrypted_inode(parent_inode) condition because in f2fs_is_child_context_consistent_with_parent we have the same verification. /* no restrictions if the parent directory is not encrypted */ if (!f2fs_encrypted_inode(parent)) return 1; Thanks, > > Thanks, > > > + > > f2fs_balance_fs(sbi); > > > > old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); > > -- > > 2.1.1 > > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > Linux-f2fs-devel mailing list > > Linux-f2fs-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ------------------------------------------------------------------------------ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-29 2:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-05-25 10:07 [PATCH 1/3] f2fs crypto: check context consistent for rename2 Chao Yu 2015-05-28 17:07 ` Jaegeuk Kim 2015-05-29 2:29 ` [f2fs-dev] " Jaegeuk Kim 2015-05-29 2:54 ` Chao Yu
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).