Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2018-07-06 08:03:09 -0500
committerGoldwyn Rodrigues <rgoldwyn@suse.com>2018-07-06 08:03:17 -0500
commit6893c3b6180c300bc4020eeaf1edee09585883e1 (patch)
tree19a96f02bc8792ed38458279164a43bdd50155b9
parentb51e954feed9a22b250700793cc1766cc9191dd0 (diff)
ovl: fix uid/gid when creating over whiteout (bsc#1099993).
-rw-r--r--fs/overlayfs/dir.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 1ead1cbd1c19..7a3fb6f73f0b 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -422,12 +422,21 @@ static int ovl_create_or_link(struct dentry *dentry, int mode, dev_t rdev,
err = ovl_create_upper(dentry, inode, &stat, link, hardlink);
} else {
const struct cred *old_cred;
+ struct cred *override_cred;
old_cred = ovl_override_creds(dentry->d_sb);
- err = ovl_create_over_whiteout(dentry, inode, &stat, link,
- hardlink);
+ err = -ENOMEM;
+ override_cred = prepare_creds();
+ if (override_cred) {
+ override_cred->fsuid = old_cred->fsuid;
+ override_cred->fsgid = old_cred->fsgid;
+ put_cred(override_creds(override_cred));
+ put_cred(override_cred);
+ err = ovl_create_over_whiteout(dentry, inode, &stat,
+ link, hardlink);
+ }
revert_creds(old_cred);
}