Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp768316ybl; Wed, 11 Dec 2019 07:14:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxapFnNA0ZUwSnMNILkX93cj1FW4SR6V7IRYTw6jVzTZEEgimn+Q5Owz/IoB4GiB3687jVt X-Received: by 2002:aca:554d:: with SMTP id j74mr3289569oib.92.1576077269383; Wed, 11 Dec 2019 07:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077269; cv=none; d=google.com; s=arc-20160816; b=JBAQ6Ye0NJPMIlKAJpaMY65wYR0NYcnqfxAgVS9Ge0kzTB1LKySlAV4Q/2fqEVJEl4 mxsiZ2Lu5YeRikiN5hxn2YwIJdFgibsQP60xTh5srm501SUqYOpZaXrgQdNTXCw6cPMj Fq90XLudU1B0ZjTU7nbOfADFbGZx60lf+ixNVujrA0AIbztp4J83M2x0JpD/8IQ0Roc4 IqfjawivA50zKmIbmjG2cEaeMcSamSTedWFIJM/h1dHUggBLiTdNiLKNc5KPS9ep0alI FJe2K0jZKGgv69zBlyV8BY3j3VrJBEIN1kOCovWc0j6JefUFtCgrD3ahhIKTuhOhNU2F obwQ== 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=4V207DXwyhpS8aNpLqAVq/qCUg1w9oOfySTv2RJAg0g=; b=jeWTNz4HU3/P+6LUXb2iL+tvSWT1dHOfJKhH+RNERYVLVbftQUeovUiYicUJnXmPpp yB+5chjiPyXLgxCW5xamij/ZuMV31hXpoApRSd7fiWOeBJ9WXrVfNOfIxors6DT3Vsli Kod+mfn6iwlUJK0Y06MNxCAYLPtTbnmbRJMjgxV4S2oVEFMmUAKzUp/Au+BxeVg4BYhA 8IpX6b+VzFAERFdRmMZeFj4p6vArTX74jcahnlkegFOFHxCL9E7Qnq6uKarK/GderS2v d7oBDwaOT8LAc3W9ulmxSfLgwrXM5GjxwBo1sXJrBluzRFDkDNrwAIWATpToDiqIbsqd QdZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uljg34Gt; 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 u186si1318262oig.29.2019.12.11.07.14.17; Wed, 11 Dec 2019 07:14:29 -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=uljg34Gt; 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 S1730537AbfLKPMA (ORCPT + 99 others); Wed, 11 Dec 2019 10:12:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730988AbfLKPLy (ORCPT ); Wed, 11 Dec 2019 10:11:54 -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 1BD7B24656; Wed, 11 Dec 2019 15:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077113; bh=4k5lCqv1h3YYH4AA9kIguuzaH3ELRVcCQ2qK2QzcEjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uljg34GtFlAKrQtXkCJzEls34IpKrsQx3ke8+zsWDv+vHIZjQT9mUXYFprqEyaMQ2 dBLhLw2AW5AcIFn74F6Bjs6AOkID46kY6F7Vdb/c7KwBh1s4YRhOZGPaXfNe7bSjR3 JoEMgTXXPVZ88CNr8+jKNBWFiUQfe+2hFwRQMooc= 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 022/105] audit_get_nd(): dont unlock parent too early Date: Wed, 11 Dec 2019 16:05:11 +0100 Message-Id: <20191211150227.393353419@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 69924b89687a2923e88cc42144aea27868913d0e ] if the child has been negative and just went positive under us, we want coherent d_is_positive() and ->d_inode. Don't unlock the parent until we'd done that work... Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- kernel/audit_watch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 1f31c2f1e6fc1..4508d5e0cf696 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -351,12 +351,12 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent) struct dentry *d = kern_path_locked(watch->path, parent); if (IS_ERR(d)) return PTR_ERR(d); - inode_unlock(d_backing_inode(parent->dentry)); if (d_is_positive(d)) { /* update watch filter fields */ watch->dev = d->d_sb->s_dev; watch->ino = d_backing_inode(d)->i_ino; } + inode_unlock(d_backing_inode(parent->dentry)); dput(d); return 0; } -- 2.20.1