Skip to contentSkip to conversation

ovl: fix file reference leak when submitting aio

PATCH New Amir Goldstein 1 participant 1 message Oct 2, 2023

Subsystems (2)
lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: fix file reference leak when submitting aio

Commit 724768a39374 ("ovl: fix incorrect fdput() on aio completion") took a refcount on real file before submitting aio, but forgot to avoid clearing FDPUT_FPUT from real.flags stack variable. This can result in a file reference leak.

Fixes 724768a39374 ("ovl: fix incorrect fdput() on aio completion")

---

Miklos,

This is a fix for an unfortunate braino merged to 6.6-rc2. I will queue it up for 6.6-rc5.

Gil has caught this bug in post mortem review.
Thanks for reporting the bug!

Amir.

 fs/overlayfs/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/overlayfs/file.c +0 -2
index 693971d20280..8be4dc050d1e 100644
@@ -341,7 +341,6 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter)
 		if (!aio_req)
 			goto out;
 
-		real.flags = 0;
 		aio_req->orig_iocb = iocb;
 		kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
 		aio_req->iocb.ki_complete = ovl_aio_rw_complete;
@@ -413,7 +412,6 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter)
 		if (!aio_req)
 			goto out;
 
-		real.flags = 0;
 		aio_req->orig_iocb = iocb;
 		kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
 		aio_req->iocb.ki_flags = ifl;
Signature · 1 line
2.34.1