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@xxxxxxxxx> diff --git a/fs/aio.c b/fs/aio.c index b36691268b6c..9075571e673f 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1436,7 +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); - return ret; + goto err; } req->ki_ioprio = iocb->aio_reqprio; @@ -1444,6 +1444,7 @@ static int aio_prep_rw(struct kiocb *req, struct iocb *iocb) req->ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); ret = kiocb_set_rw_flags(req, iocb->aio_rw_flags); +err: if (unlikely(ret)) fput(req->ki_filp); return ret; -- Jens Axboe