aio: fix failure to put the file pointer
PATCH 1/1 aio: fix failure to put the file pointer
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 <[email protected]>
fs/aio.c +2 -1
@@ -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;
Signature · 1 line
Jens Axboe
Al Viro
maintainerQuoted 11 lines · Jens Axboe
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 <[email protected]>fs/aio.c +0
-0
fs/aio.c static int aio_prep_rw(struct kiocb *req, struct iocb *iocb) · line 1439
Quoted 5 lines
fs/aio.c +1
-1@@ -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;
Better an explicit fput() here, IMO...
Quoted 7 lines · Al Viro
Quoted 6 lines · Jens Axboe
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 <[email protected]>
Quoted 12 lines
fs/aio.c static int aio_prep_rw(struct kiocb *req, struct iocb *iocb) · line 1439
Quoted 10 lines
fs/aio.c +1
-1@@ -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;Better an explicit
fput()here, IMO...
OK, v2 sent.
Signature · 1 line
Jens Axboe