Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp430137pxk; Fri, 11 Sep 2020 10:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv8Jgu6xSPAwKBW24rG5vQI5ehRrkSFQL0ok561yj2vOWSvhQ73MlgrUm9ZqhP3MUN6Kyg X-Received: by 2002:a05:6402:1641:: with SMTP id s1mr3500742edx.66.1599845930639; Fri, 11 Sep 2020 10:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599845930; cv=none; d=google.com; s=arc-20160816; b=tLadC1ykrg4dhMTPKjaox/RMeERog6K3rgX/ZNWgq6sFPU9sY154oOiE9ZuYpgNFS7 2nwwOImhTL3d6N6FD582u/6fuqWbtWXWO2OF1ePX5NnRCJ1nqbtn6LfC3MPzEqt4g3ST KMR7lBMSfAnpz9j9/NLGKARsZ6s+iPNVicKo2A/WiyFfCQoCAc24RLyW4jSeFwkt9/b+ dOwj6RKHq6PL66Ix7qSnV/xi0jIGqidXbY4LKM4l7BDGOWVCmTpdhlbwD/PJ3vudWqcu B31+7f3p/bECiNbHnkLxaX7aZArUGn139nzK+X0p6Qh8RCFAuSdNjZRGtoSckaG/3g1O vLgw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UvcTjjkAEoGLjb/W6sH3giogkWXaWoUe43PBEI9Jg7s=; b=BkP9Kv/mwADn7liwJO/PRUkbXAv2TQr/LwuNE7GtLhgqHxayRB/iG6tOylYCIUBD6S 0zZnIeFGAqxIMf8kv+P5wgzstoWwaX4OTT27NYWlIVadXZHKysJXWEqQwPsp/cNf4KgE j0C9nJGC7Wax19iX0/nQ1v3P+boj4GAo/UJq2PUAFvzikDeu84mROyu9aZP4WuOoWT+3 h9k6fTEHPjj/7dE4m9TSGAbjYXU1DFoK5bbAsYPYQkhANEnqqJ41s0dCZCkq76Lmergy KD3PxfG9M+1G+RPTiqVMNILBtT72O9p0mhxKG8Ru0vU8rvi1eR3V8vmJBZsHK3/tgGt+ pL2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gPEC023V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si1723768edv.154.2020.09.11.10.38.27; Fri, 11 Sep 2020 10:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gPEC023V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbgIKRfx (ORCPT + 99 others); Fri, 11 Sep 2020 13:35:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:49206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbgIKMye (ORCPT ); Fri, 11 Sep 2020 08:54:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 1D98F2220A; Fri, 11 Sep 2020 12:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599828813; bh=q5AMvphCxcmQP1H/0lgF/CoRmF8mzY/oFlElmY/dmv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPEC023Vr/vTYUnsRLN4twMUZ9/iZVFxYufDbuhVXPYlx7qW4UH6nK9wUiqxa5axE OJHjbAXR5DyAkk2fXQzxUe+4EtDJp3Zc0m4xfwtp3njUnpzFqSL5YFneN5omErZZ3A g2h22WU/bTLON6vFPbhJuEq4+7g+0QgkXeUtHXbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Al Viro , Sasha Levin Subject: [PATCH 4.4 17/62] fix regression in "epoll: Keep a reference on files added to the check list" Date: Fri, 11 Sep 2020 14:46:00 +0200 Message-Id: <20200911122503.245259147@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122502.395450276@linuxfoundation.org> References: <20200911122502.395450276@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 [ Upstream commit 77f4689de17c0887775bb77896f4cc11a39bf848 ] epoll_loop_check_proc() can run into a file already committed to destruction; we can't grab a reference on those and don't need to add them to the set for reverse path check anyway. Tested-by: Marc Zyngier Fixes: a9ed4a6560b8 ("epoll: Keep a reference on files added to the check list") Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- fs/eventpoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index b8959d0d4c723..e5324642023d6 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1720,9 +1720,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) * during ep_insert(). */ if (list_empty(&epi->ffd.file->f_tfile_llink)) { - get_file(epi->ffd.file); - list_add(&epi->ffd.file->f_tfile_llink, - &tfile_check_list); + if (get_file_rcu(epi->ffd.file)) + list_add(&epi->ffd.file->f_tfile_llink, + &tfile_check_list); } } } -- 2.25.1