ovl: credential not reverted in ovl_copy_up_flags on error case
PATCH 1/1 ovl: credential not reverted in ovl_copy_up_flags on error case
In "ovl_copy_up_flags" on disconnected dir case(error case), credential not reverted.
Fixes aa3ff3c152ff9("ovl: copy up of disconnected dentries")
Signed-off-by youngjun <[email protected]>
--- fs/overlayfs/copy_up.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/overlayfs/copy_up.c +3 -1
@@ -906,8 +906,10 @@ int ovl_copy_up_flags(struct dentry *dentry, int flags)* In this case, we will copy up lower inode to index dir without * linking it to upper dir. */ -if (WARN_ON (disconnected &&d_is_dir (dentry))) +if (WARN_ON (disconnected &&d_is_dir (dentry))) { +revert_creds (old_cred);return -EIO ; + }while (!err) {struct dentry *next;
Signature · 1 line
2.17.1
Amir Goldstein
maintainerQuoted 15 lines · youngjun
In "
ovl_copy_up_flags" on disconnected dir case(error case), credential not reverted.Fixes aa3ff3c152ff9("ovl: copy up of disconnected dentries")Signed-off-by youngjun <[email protected]>--- fs/overlayfs/copy_up.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/overlayfs/copy_up.c +0
-0
fs/overlayfs/copy_up.c int ovl_copy_up_flags(struct dentry *dentry, int flags) · line 913
Quoted 9 lines
fs/overlayfs/copy_up.c +3
-1@@ -906,8 +906,10 @@ int ovl_copy_up_flags(struct dentry *dentry, int flags)* In this case, we will copy up lower inode to index dir without * linking it to upper dir. */ -if (WARN_ON (disconnected &&d_is_dir (dentry))) +if (WARN_ON (disconnected &&d_is_dir (dentry))) { +revert_creds (old_cred);return -EIO ; + }
It is better to move ovl_override_creds() after the WARN_ON test. which does not require any credentials.
Thanks,
Amir.