Patch "ovl: mark parent impure on ovl_link()" has been added to the 4.12-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ovl: mark parent impure on ovl_link()
to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ovl-mark-parent-impure-on-ovl_link.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
ea3dad18dc5f778cfd931311a91a9315aa0065a3Mon Sep 17 00:00:00 2001
From: Amir Goldstein <[email protected]>
Date: Tue, 11 Jul 2017 15:58:34 +0300
Subject: ovl: mark parent impure on ovl_link()
From: Amir Goldstein <[email protected]>
commit ea3dad18dc5f778cfd931311a91a9315aa0065a3 upstream.
When linking a file with copy up origin into a new parent, mark the new parent dir "impure".
--- fs/overlayfs/dir.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
fs/overlayfs/dir.c +18 -4
@@ -478,17 +478,30 @@ out_cleanup: }static int ovl_create_or_link (struct dentry *dentry,struct inode *inode, -struct cattr *attr,struct dentry *hardlink) +struct cattr *attr,struct dentry *hardlink, +bool origin) {int err;const struct cred *old_cred;struct cred *override_cred; +struct dentry *parent = dentry->d_parent; - err =ovl_copy_up (dentry->d_parent); + err =ovl_copy_up (parent);if (err)return err; old_cred =ovl_override_creds (dentry->d_sb); + +/* +* When linking a file with copy up origin into a new parent, mark the +* new parent dir "impure". +*/ +if (origin) { + err =ovl_set_impure (parent,ovl_dentry_upper (parent)); +if (err) + goto out_revert_creds; + } + err = -ENOMEM ; override_cred =prepare_creds ();if (override_cred) {
@@ -547,7 +560,7 @@ static int ovl_create_object(struct dentinode_init_owner (inode, dentry->d_parent->d_inode, mode); attr.mode = inode->i_mode; - err =ovl_create_or_link (dentry, inode, &attr,NULL ); + err =ovl_create_or_link (dentry, inode, &attr,NULL , false);if (err)iput (inode);
@@ -601,7 +614,8 @@ static int ovl_link(struct dentry *old, inode =d_inode (old);ihold (inode); - err =ovl_create_or_link (new, inode,NULL ,ovl_dentry_upper (old)); + err =ovl_create_or_link (new, inode,NULL ,ovl_dentry_upper (old), +ovl_type_origin (old));if (err)iput (inode);
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/ovl-mark-parent-impure-on-ovl_link.patch queue-4.12/ovl-fix-random-return-value-on-mount.patch