diff mbox series

[AUTOSEL,4.19,041/123] aio: fix failure to put the file pointer

Message ID 20181205093555.5386-41-sashal@kernel.org
State New, archived
Headers show
Series None | expand

Commit Message

Sasha Levin Dec. 5, 2018, 9:34 a.m. UTC
From: Jens Axboe <axboe@kernel.dk>

[ Upstream commit 53fffe29a9e664a999dd3787e4428da8c30533e0 ]

If the ioprio capability check fails, we return without putting
the file pointer.

Fixes: d9a08a9e616b ("fs: Add aio iopriority support")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
 fs/aio.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/fs/aio.c b/fs/aio.c
index b9350f3360c6..04c4d6218978 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1436,6 +1436,7 @@  static int aio_prep_rw(struct kiocb *req, struct iocb *iocb)
 		ret = ioprio_check_cap(iocb->aio_reqprio);
 		if (ret) {
 			pr_debug("aio ioprio check cap error: %d\n", ret);
+			fput(req->ki_filp);
 			return ret;