From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f196.google.com ([209.85.215.196]:44305 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726020AbeKRAyk (ORCPT ); Sat, 17 Nov 2018 19:54:40 -0500 Received: by mail-pg1-f196.google.com with SMTP id t13so3213050pgr.11 for ; Sat, 17 Nov 2018 06:37:48 -0800 (PST) To: Alexander Viro Cc: "linux-aio@kvack.org" , linux-fsdevel From: Jens Axboe Subject: [PATCH] aio: fix failure to put the file pointer Message-ID: <80eae85d-c307-71fb-bdfe-5a38236fbf87@kernel.dk> Date: Sat, 17 Nov 2018 07:37:44 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 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