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.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 2304FC432C0 for ; Fri, 22 Nov 2019 19:51:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF16C2070E for ; Fri, 22 Nov 2019 19:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574452318; bh=tawO3EiEOzoXBA5escWcgSKwcPu0Xc1V1YBXwfOTuws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Kmc243rwNcB2ZJ7Lx94PRUhYdFLRVjKoLTSlzvilVVN2i+6HTIhIa6oiDL64CijZ1 fV6vUNlToI53q315Ow0fuq2I7uakDZLuHp3FyO7C/PEfBXgxklSf3+QRbJuYwd2Hml xap/8QTl1S/2crau7qUeEc370dTwSR50sDtPJlwU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728010AbfKVTv5 (ORCPT ); Fri, 22 Nov 2019 14:51:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbfKVTuD (ORCPT ); Fri, 22 Nov 2019 14:50:03 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B2D92075E; Fri, 22 Nov 2019 19:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574452203; bh=tawO3EiEOzoXBA5escWcgSKwcPu0Xc1V1YBXwfOTuws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uqKnAZZwkJvUW1XRJFgnC4FewJZjN4Bs/kPvfiZ2Kpu2kIn3A1zWlFjyJ1dSEeYmx zRW7/SiRr2hil8NZ/yt2bjRt+/b1ITJcTmp0ufk5eHJ1hcUDEpLnUd85DnREKMP21Z 0lE4ou29pl3J7+TYH25fX+VD5DARU4hExSdVxhjc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Al Viro , Sasha Levin , linux-audit@redhat.com Subject: [PATCH AUTOSEL 4.9 04/13] audit_get_nd(): don't unlock parent too early Date: Fri, 22 Nov 2019 14:49:49 -0500 Message-Id: <20191122194958.24926-4-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122194958.24926-1-sashal@kernel.org> References: <20191122194958.24926-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 f036b6ada6efc..712469a3103ac 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -365,12 +365,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