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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 EF35AC2D0C3 for ; Mon, 16 Dec 2019 18:51:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDE9F2166E for ; Mon, 16 Dec 2019 18:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576522266; bh=+NyR+5ZkSauhPyZqxIyCrMeEajUoSH5Z90ILzUX3lfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jQx3spHgkpskoYZE0Z829Gb50THPTIRrxRKlIm/hZfenoLVoeupxfHRjtRMRCLygs CcpXc6cpFJEzaShZ0BQu0ZJB2TY33E1IkxixbiMCKHKyrjOVng+szQE7vEls/AXTOb F7fqwPwEUvSaWXv+rcb5m7jqK2FF1j5jUeTaAb7k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbfLPRvA (ORCPT ); Mon, 16 Dec 2019 12:51:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:40400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfLPRu4 (ORCPT ); Mon, 16 Dec 2019 12:50:56 -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 CB50420700; Mon, 16 Dec 2019 17:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576518656; bh=+NyR+5ZkSauhPyZqxIyCrMeEajUoSH5Z90ILzUX3lfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/QuXo4pX/80oOpRimv+cArKVz5ZYGt0fTiGV58VIWeDlQKMAvsfAZZFahEVOjKo3 3fjZFVgSMIDxFQrc+uXjAhXR+x+FALO06rQLSASP+FV2O2MYJ4knV1dnWHohBy0TCa I2xXalhYGn/8RfzDcCFZEr/O1LEsmTttKehPEj0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Sasha Levin Subject: [PATCH 4.14 013/267] audit_get_nd(): dont unlock parent too early Date: Mon, 16 Dec 2019 18:45:39 +0100 Message-Id: <20191216174850.367788736@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174848.701533383@linuxfoundation.org> References: <20191216174848.701533383@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 4a98f6e314a9b..35f1d706bd5b4 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