From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9389C433DF for ; Mon, 24 Aug 2020 08:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8BF82072D for ; Mon, 24 Aug 2020 08:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598259171; bh=pxdUTj6pAzwoMonc6AmjmuwYZabgePWP3MFhqs9P0nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vzRtNU6SQq3T1U1XlK1pTojjg/2OJbcHQalhLJKBNe26N+lbpFmbKLO0NL69XHshj E2p7tbybPRjr0zAeb3YzLjFUxB7uIOthmMkXNePvKDXZQxPn+i8TXawpH2fx+hFwgu z5s9cBFibpRSJ2p2pJc/sCib5VATXIhdBgI5w+x0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbgHXIwt (ORCPT ); Mon, 24 Aug 2020 04:52:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:58610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730090AbgHXIwZ (ORCPT ); Mon, 24 Aug 2020 04:52:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0860207D3; Mon, 24 Aug 2020 08:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598259145; bh=pxdUTj6pAzwoMonc6AmjmuwYZabgePWP3MFhqs9P0nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2RJNDsLLtjK1Mdrx1drlf2+y/+2p5lR8PLntklNoT7A1+EcaTe1PhHwjPkXuIDfI hOTcxNlO3xrYJPzZE9wZoamNHoOz1byPS249FzMP2l8kWRDmj80p0qIyXloytfrLzV J/yKwcyKJqSLMJRebjbxobK8KyR++QQj56pjkbwg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Marc Zyngier Subject: [PATCH 4.9 37/39] do_epoll_ctl(): clean the failure exits up a bit Date: Mon, 24 Aug 2020 10:31:36 +0200 Message-Id: <20200824082350.430913540@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082348.445866152@linuxfoundation.org> References: <20200824082348.445866152@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 commit 52c479697c9b73f628140dcdfcd39ea302d05482 upstream. Signed-off-by: Al Viro Signed-off-by: Marc Zyngier Signed-off-by: Greg Kroah-Hartman --- fs/eventpoll.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1946,10 +1946,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, in mutex_lock(&epmutex); if (is_file_epoll(tf.file)) { error = -ELOOP; - if (ep_loop_check(ep, tf.file) != 0) { - clear_tfile_check_list(); + if (ep_loop_check(ep, tf.file) != 0) goto error_tgt_fput; - } } else { get_file(tf.file); list_add(&tf.file->f_tfile_llink, @@ -1978,8 +1976,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, in error = ep_insert(ep, &epds, tf.file, fd, full_check); } else error = -EEXIST; - if (full_check) - clear_tfile_check_list(); break; case EPOLL_CTL_DEL: if (epi) @@ -2002,8 +1998,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, in mutex_unlock(&ep->mtx); error_tgt_fput: - if (full_check) + if (full_check) { + clear_tfile_check_list(); mutex_unlock(&epmutex); + } fdput(tf); error_fput: