Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp116984imc; Sat, 9 Mar 2019 23:12:39 -0800 (PST) X-Google-Smtp-Source: APXvYqy0xYi6T5utUol/NX4vRMFJMKOzJ87J/HPez0aeljug/Inr9D+BoCr6UmICwTv8VpFsWRoz X-Received: by 2002:a17:902:8ecb:: with SMTP id x11mr27179634plo.40.1552201959599; Sat, 09 Mar 2019 23:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552201959; cv=none; d=google.com; s=arc-20160816; b=Mi0YyqG8Aq9043ZT5c+iWsC1K6/3FcJv0mri/Hr+2rvhkYqpQL8DNl8/PFK6dUIfvC fSPjALlneQYLto4CVKqZgQamYnJUHD+QLDDN0zNmI21NpQP+UZJMOOSk+wC22IO1pDaL lTy6dPGgl0ZN4wlqvVlqqq8BRIZa6A5ICpJk3XxlwMnTDc7VLf851FJystrxFzZ09gU3 J9cVZv6tKrhipKyYQ2yCeZknWXtwWhD6R5guFN2nDao3F4SUWzYKd71A2cnFgwuTZRTy le0har87J3+1BeopzpM8wbGBFAYSp7+TebtaQBDhaDa2s+dpmt5QlJTi7b8glIlsG41h zVTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/Ej/2fly9QA/81iNzLYrXaOZh3ZvEg4qXN/weCbXBgo=; b=d/pn20ZprqddSj2MyPnjpu/T9l5fJNsQ20IFJAfDJks0HT2lMj7nPh4qWJJRtoMDzG l/pj6rR7vjSX+7ftTqrB02sV7bDorLqDja5gV15wHqBOOZ2yR+gtKfNUyX7/ui34c3AV MYhjUQSRjAa96nawhDBZynequcOPtssmm9/tXWG4lFkJwIoIZZbNKXLTKla1sXFCVx7b pvVOcByb0/6aaJQ+xq6cGOm7rkrkxtQDwyCr25/7o/cRn2Fyv6syipSn5PUgufZ0vuWG 42XHca/6g/0d/Jp9DPvkBbQiMRvrzMbiLnt5CjMb7wwOcGAmgeXNSEa/4qp+JdVdTaa0 EtHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x33si2277770pga.130.2019.03.09.23.12.24; Sat, 09 Mar 2019 23:12:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbfCJHLp (ORCPT + 99 others); Sun, 10 Mar 2019 03:11:45 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:35512 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbfCJHLp (ORCPT ); Sun, 10 Mar 2019 03:11:45 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1h2sbY-0003BI-O1; Sun, 10 Mar 2019 07:10:49 +0000 From: Al Viro To: Linus Torvalds Cc: Eric Dumazet , David Miller , Jason Baron , kgraul@linux.ibm.com, ktkhai@virtuozzo.com, kyeongdon.kim@lge.com, Linux List Kernel Mailing , Netdev , pabeni@redhat.com, syzkaller-bugs@googlegroups.com, xiyou.wangcong@gmail.com, Christoph Hellwig , zhengbin , bcrl@kvack.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, houtao1@huawei.com, yi.zhang@huawei.com Subject: [PATCH 6/8] move dropping ->ki_eventfd into iocb_destroy() Date: Sun, 10 Mar 2019 07:08:20 +0000 Message-Id: <20190310070822.11564-6-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190310070822.11564-1-viro@ZenIV.linux.org.uk> References: <20190310070606.GA10138@ZenIV.linux.org.uk> <20190310070822.11564-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/aio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index f9e8f1edfe36..595c19965a8b 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1071,6 +1071,8 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) static inline void iocb_destroy(struct aio_kiocb *iocb) { + if (iocb->ki_eventfd) + eventfd_ctx_put(iocb->ki_eventfd); if (iocb->ki_filp) fput(iocb->ki_filp); percpu_ref_put(&iocb->ki_ctx->reqs); @@ -1138,10 +1140,8 @@ static void aio_complete(struct aio_kiocb *iocb) * eventfd. The eventfd_signal() function is safe to be called * from IRQ context. */ - if (iocb->ki_eventfd) { + if (iocb->ki_eventfd) eventfd_signal(iocb->ki_eventfd, 1); - eventfd_ctx_put(iocb->ki_eventfd); - } /* * We have to order our ring_info tail store above and test @@ -1810,18 +1810,19 @@ static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb, goto out_put_req; if (iocb->aio_flags & IOCB_FLAG_RESFD) { + struct eventfd_ctx *eventfd; /* * If the IOCB_FLAG_RESFD flag of aio_flags is set, get an * instance of the file* now. The file descriptor must be * an eventfd() fd, and will be signaled for each completed * event using the eventfd_signal() function. */ - req->ki_eventfd = eventfd_ctx_fdget((int) iocb->aio_resfd); - if (IS_ERR(req->ki_eventfd)) { - ret = PTR_ERR(req->ki_eventfd); - req->ki_eventfd = NULL; + eventfd = eventfd_ctx_fdget((int) iocb->aio_resfd); + if (IS_ERR(eventfd)) { + ret = PTR_ERR(eventfd); goto out_put_req; } + req->ki_eventfd = eventfd; } ret = put_user(KIOCB_KEY, &user_iocb->aio_key); @@ -1875,8 +1876,6 @@ static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb, return 0; out_put_req: - if (req->ki_eventfd) - eventfd_ctx_put(req->ki_eventfd); iocb_destroy(req); out_put_reqs_available: put_reqs_available(ctx, 1); -- 2.11.0