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=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 8A1A0C5DF60 for ; Fri, 8 Nov 2019 17:36:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 570E22084D for ; Fri, 8 Nov 2019 17:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573234610; bh=Z5PC9TyEJyhxYOxCrC1Zax/Nk+Czo1m2ho8nUruVkNU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=AIAPMvTx96onWI1lMy32pjripoD+jQzl3u9fimG3OZjNe17uApMXXzJQWiAswllJw h/2eTbiZrfyLoGMw/6ZauOZcS4WAV0yjpUBLg10YYOeEUOlUnir4RrMIG+rx3htZSt dO0F3nEfbdm9p5/yH1lsBUc8i5lbmdM1sWU0LyuE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727903AbfKHRgt (ORCPT ); Fri, 8 Nov 2019 12:36:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:56064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbfKHRgt (ORCPT ); Fri, 8 Nov 2019 12:36:49 -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 5B601206C3; Fri, 8 Nov 2019 17:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573234606; bh=Z5PC9TyEJyhxYOxCrC1Zax/Nk+Czo1m2ho8nUruVkNU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xguf2wJbyG57vD6nZvUAZcr+NFro9D5/SmEP6fi4HIyRvdpOPq0Qp9dO246oSAqvi MWFjkK7uOldPAhVi74u9QN+dtnoCAvgKBIDNz/4IkjTsDylnK/SQbCGDD0X9jTHdRm V063nd/XVbYpItqoWQ+Yr3ZDiTrr60cOI1XJzBdw= Date: Fri, 8 Nov 2019 18:36:44 +0100 From: Greg KH To: "zhangyi (F)" Cc: stable@vger.kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH for linux 4.4.y/3.16.y] fs/dcache: move security_d_instantiate() behind attaching dentry to inode Message-ID: <20191108173644.GA1210939@kroah.com> References: <20191106094352.9665-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191106094352.9665-1-yi.zhang@huawei.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Nov 06, 2019 at 05:43:52PM +0800, zhangyi (F) wrote: > During backport 1e2e547a93a "do d_instantiate/unlock_new_inode > combinations safely", there was a error instantiating sequence of > attaching dentry to inode and calling security_d_instantiate(). > > Before commit ce23e640133 "->getxattr(): pass dentry and inode as > separate arguments" and b96809173e9 "security_d_instantiate(): move to > the point prior to attaching dentry to inode", security_d_instantiate() > should be called beind __d_instantiate(), otherwise it will trigger > below problem when CONFIG_SECURITY_SMACK on ext4 was enabled because > d_inode(dentry) used by ->getxattr() is NULL before __d_instantiate() > instantiate inode. > > [ 31.858026] BUG: unable to handle kernel paging request at ffffffffffffff70 > ... > [ 31.882024] Call Trace: > [ 31.882378] [] ext4_xattr_get+0x8c/0x3e0 > [ 31.883195] [] ext4_xattr_security_get+0x24/0x40 > [ 31.884086] [] generic_getxattr+0x5b/0x90 > [ 31.884907] [] smk_fetch+0xb4/0x150 > [ 31.885634] [] smack_d_instantiate+0x1c2/0x550 > [ 31.886508] [] security_d_instantiate+0x3a/0x80 > [ 31.887389] [] d_instantiate_new+0x36/0x130 > [ 31.888223] [] ext4_mkdir+0x4af/0x6a0 > [ 31.888928] [] vfs_mkdir+0x100/0x280 > [ 31.889536] [] SyS_mkdir+0xb6/0x170 > [ 31.890255] [] ? trace_do_page_fault+0x95/0x2b0 > [ 31.891134] [] entry_SYSCALL_64_fastpath+0x18/0x73 > > Cc: # 3.16, 4.4 > Signed-off-by: zhangyi (F) > --- > fs/dcache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Now queued up for 4.4.y, thanks. greg k-h