Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757331AbaAIXxq (ORCPT ); Thu, 9 Jan 2014 18:53:46 -0500 Received: from mail-ea0-f179.google.com ([209.85.215.179]:54788 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751583AbaAIXxm (ORCPT ); Thu, 9 Jan 2014 18:53:42 -0500 MIME-Version: 1.0 In-Reply-To: <1389310626.15209.92.camel@localhost> References: <20140109162731.12500986@gandalf.local.home> <20140109214239.GD29910@parisc-linux.org> <20140109165012.391db81e@gandalf.local.home> <20140109223127.GM10323@ZenIV.linux.org.uk> <20140109182523.5b50131f@gandalf.local.home> <20140109182756.17abaaa8@gandalf.local.home> <1389310626.15209.92.camel@localhost> Date: Fri, 10 Jan 2014 07:53:41 +0800 X-Google-Sender-Auth: FY5HZCkT3qD0dEur4cKlPAmdzyI Message-ID: Subject: Re: [PATCH] vfs: Fix possible NULL pointer dereference in inode_permission() From: Linus Torvalds To: Eric Paris Cc: Steven Rostedt , Al Viro , Paul McKenney , Dave Chinner , linux-fsdevel , James Morris , Andrew Morton , Stephen Smalley , "Theodore Ts'o" , stable , Paul Moore , LKML , Matthew Wilcox , Christoph Hellwig Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 10, 2014 at 7:37 AM, Eric Paris wrote: > > but at least from an SELinux PoV, I think it's quick and easy, but wrong > for maintainability... Yeah, it's a hack, and it's wrong, and we should figure out how to do it right. Likely we should just tie the lifetime of the i_security member directly to the lifetime of the inode itself, and just make the rule be that security_inode_free() gets called from whatever frees the inode itself, and *not* have an extra rcu callback etc. But that sounds like a bigger change than I'm comfy with right now, so the hacky one might be the band-aid to do for stable.. The problem, of course, is that all the different filesystems have their own inode allocations/freeing. Of course, they all tend to share the same pattern ("call_rcu xyz_i_callback"), so maybe we could try to make that a more generic thing? Like have a "free_inode" vfs callback, and do the call_rcu delaying at the VFS level.. And maybe, just maybe, we could just say that that is what "destroy_inode()" is, and that we will just call it from rcu context. All the IO has hopefully been done earlier Yes/no? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/