Skip to content

Commit

Permalink
Merge tag 'ovl-fixes-5.17-rc3' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/mszeredi/vfs

Pull overlayfs fixes from Miklos Szeredi:
 "Fix a regression introduced in v5.15, affecting copy up of files with
  'noatime' or 'sync' attributes to a tmpfs upper layer"

* tag 'ovl-fixes-5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: don't fail copy up if no fileattr support on upper
  ovl: fix NULL pointer dereference in copy up warning
  • Loading branch information
torvalds committed Feb 1, 2022
2 parents 1a2beb3 + 94fd197 commit 24d7f48
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions fs/overlayfs/copy_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
if (err == -ENOTTY || err == -EINVAL)
return 0;
pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
old, err);
old->dentry, err);
return err;
}

Expand All @@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
*/
if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {
err = ovl_set_protattr(inode, new->dentry, &oldfa);
if (err)
if (err == -EPERM)
pr_warn_once("copying fileattr: no xattr on upper\n");
else if (err)
return err;
}

Expand All @@ -167,8 +169,16 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,

err = ovl_real_fileattr_get(new, &newfa);
if (err) {
/*
* Returning an error if upper doesn't support fileattr will
* result in a regression, so revert to the old behavior.
*/
if (err == -ENOTTY || err == -EINVAL) {
pr_warn_once("copying fileattr: no support on upper\n");
return 0;
}
pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
new, err);
new->dentry, err);
return err;
}

Expand Down

0 comments on commit 24d7f48

Please sign in to comment.