Skip to content

Commit 24d7f48

Browse files
committed
Merge tag 'ovl-fixes-5.17-rc3' of git://git.kernel.org/pub/scm/linux/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
2 parents 1a2beb3 + 94fd197 commit 24d7f48

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

fs/overlayfs/copy_up.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
145145
if (err == -ENOTTY || err == -EINVAL)
146146
return 0;
147147
pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
148-
old, err);
148+
old->dentry, err);
149149
return err;
150150
}
151151

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

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

168170
err = ovl_real_fileattr_get(new, &newfa);
169171
if (err) {
172+
/*
173+
* Returning an error if upper doesn't support fileattr will
174+
* result in a regression, so revert to the old behavior.
175+
*/
176+
if (err == -ENOTTY || err == -EINVAL) {
177+
pr_warn_once("copying fileattr: no support on upper\n");
178+
return 0;
179+
}
170180
pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
171-
new, err);
181+
new->dentry, err);
172182
return err;
173183
}
174184

0 commit comments

Comments
 (0)