Skip to content

Commit afe03f0

Browse files
committed
Merge tag 'ovl-fixes-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs
Pull overlayfs fixes from Amir Goldstein: "Two fixes for pretty old regressions" * tag 'ovl-fixes-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs: ovl: fix incorrect fdput() on aio completion ovl: fix failed copyup of fileattr on a symlink
2 parents 0bb80ec + 724768a commit afe03f0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

fs/overlayfs/copy_up.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,8 @@ static int ovl_copy_up_metadata(struct ovl_copy_up_ctx *c, struct dentry *temp)
618618
if (err)
619619
return err;
620620

621-
if (inode->i_flags & OVL_COPY_I_FLAGS_MASK) {
621+
if (inode->i_flags & OVL_COPY_I_FLAGS_MASK &&
622+
(S_ISREG(c->stat.mode) || S_ISDIR(c->stat.mode))) {
622623
/*
623624
* Copy the fileattr inode flags that are the source of already
624625
* copied i_flags

fs/overlayfs/file.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct ovl_aio_req {
1919
struct kiocb iocb;
2020
refcount_t ref;
2121
struct kiocb *orig_iocb;
22-
struct fd fd;
2322
};
2423

2524
static struct kmem_cache *ovl_aio_request_cachep;
@@ -280,7 +279,7 @@ static rwf_t ovl_iocb_to_rwf(int ifl)
280279
static inline void ovl_aio_put(struct ovl_aio_req *aio_req)
281280
{
282281
if (refcount_dec_and_test(&aio_req->ref)) {
283-
fdput(aio_req->fd);
282+
fput(aio_req->iocb.ki_filp);
284283
kmem_cache_free(ovl_aio_request_cachep, aio_req);
285284
}
286285
}
@@ -342,10 +341,9 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter)
342341
if (!aio_req)
343342
goto out;
344343

345-
aio_req->fd = real;
346344
real.flags = 0;
347345
aio_req->orig_iocb = iocb;
348-
kiocb_clone(&aio_req->iocb, iocb, real.file);
346+
kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
349347
aio_req->iocb.ki_complete = ovl_aio_rw_complete;
350348
refcount_set(&aio_req->ref, 2);
351349
ret = vfs_iocb_iter_read(real.file, &aio_req->iocb, iter);
@@ -409,10 +407,9 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter)
409407
if (!aio_req)
410408
goto out;
411409

412-
aio_req->fd = real;
413410
real.flags = 0;
414411
aio_req->orig_iocb = iocb;
415-
kiocb_clone(&aio_req->iocb, iocb, real.file);
412+
kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
416413
aio_req->iocb.ki_flags = ifl;
417414
aio_req->iocb.ki_complete = ovl_aio_rw_complete;
418415
refcount_set(&aio_req->ref, 2);

0 commit comments

Comments
 (0)