Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp825700ybl; Wed, 11 Dec 2019 08:05:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxrWhctqcxn8umI85DVLe2WLBciq3UIIOLTgWheGzhYSzF0ZU6WebQ2wCaQf0f1Z6BiJTVl X-Received: by 2002:a9d:4c12:: with SMTP id l18mr2887082otf.140.1576080320560; Wed, 11 Dec 2019 08:05:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080320; cv=none; d=google.com; s=arc-20160816; b=zarYVmKgPOHnGwe3pJ7cNDr2EvjpnOKYzLVEDrq85qJIjGpe396sIeGg/8ij1aLEZi rbJtwjM6Hw1F5tUPCEKRZ3xZ6scic/9OqwJJgFZLQa3VTQWvhjcXielyaUR5kURCjkOp JHeuLmRxaA/ob8oLHgpFKE35+NCJlkHHORGbR/2A0nPsyRRjDGAEHFIhgIKQSEceX282 VPHL7Iri2/uYNvBuy8yAJaN+oIYCTZWAaAYy0ejccAUHcaBDVBbXppwDS0iAOV2IQJd6 PJDjPN4RxswNHTqxArfn4+WECOUHWy/k5RKQ12irxWRnuBWpWzzV9PIpr4zUFcYwo4f9 JnVg== 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=NU/jORWJHDHqsKA4PkiZXbSsBgpRqv2xIRsIotXyyvA=; b=vM+ilrLZH/QLjH6Oxz1q4nsYm4Df/o0wT2mqJ4YGb5tYjLYB22rmyaLYERX16knbip FGGtURfL0CqpEFQo17yeY44jYQ043dkgoDD73kUbgyhzPiHEoCCynWFxqZXxY2AKx2P/ 7RmRF8InpDSv716wnNaNLf9yRA1fRJeImBWyq2eIZ3CbrqBinvqEDT/FkA0iqF92NZT+ ewTuJMN1h653p01d+25PjuSf+IDdA4eDTT2idAKT7kq51DNoh5q2Ke3Bkru9GU0kEha8 1X0FI3/fzCB/B/M4riZpCStxfb3EmFfKJEaO1UvLSYNBBU254YvFO0MhJF7vkpLGrYlR JEPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fd4hFAS4; 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 c195si1380694oib.266.2019.12.11.08.05.01; Wed, 11 Dec 2019 08:05:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Fd4hFAS4; 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 S1731724AbfLKQCd (ORCPT + 99 others); Wed, 11 Dec 2019 11:02:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:36176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730747AbfLKPNK (ORCPT ); Wed, 11 Dec 2019 10:13:10 -0500 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 2378C24654; Wed, 11 Dec 2019 15:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077189; bh=Zv7X83DNDRU28FpHMArSYxtumjsi2FEoN/CxKxeC7IE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fd4hFAS4YmkTMNOOyTISe9SGiXN1wNT8X9RbM1DE3r1qK6BE5NrltH0Z6sNT4kefG 53ZnwqBn7e49MINlQ/3ecK09aRc9dM/m4uJB2eGJ73/sabQbdDyawS1jLJ8vuUmBZ0 78EKXIVDg/Ivm+rUiSvgVacwFc5ckkmBRGN1LUJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Sasha Levin Subject: [PATCH 5.3 015/105] autofs: fix a leak in autofs_expire_indirect() Date: Wed, 11 Dec 2019 16:05:04 +0100 Message-Id: <20191211150224.377878970@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@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 03ad0d703df75c43f78bd72e16124b5b94a95188 ] if the second call of should_expire() in there ends up grabbing and returning a new reference to dentry, we need to drop it before continuing. Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- fs/autofs/expire.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/autofs/expire.c b/fs/autofs/expire.c index cdff0567aacb3..2d01553a6d586 100644 --- a/fs/autofs/expire.c +++ b/fs/autofs/expire.c @@ -498,9 +498,10 @@ static struct dentry *autofs_expire_indirect(struct super_block *sb, */ how &= ~AUTOFS_EXP_LEAVES; found = should_expire(expired, mnt, timeout, how); - if (!found || found != expired) - /* Something has changed, continue */ + if (found != expired) { // something has changed, continue + dput(found); goto next; + } if (expired != dentry) dput(dentry); -- 2.20.1