From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH] vfs: Tighten up linkat(..., AT_EMPTY_PATH) Date: Wed, 21 Aug 2013 20:20:53 +0200 Message-ID: <20130821182053.GA19624@redhat.com> References: <0be9da18c0ca360773a397de3063d01019ff88d8.1377107508.git.luto@amacapital.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , "security@kernel.org" , Ingo Molnar , Willy Tarreau , linux-kernel@vger.kernel.org, Al Viro , Linux FS Devel , spender@grsecurity.net To: Andy Lutomirski Return-path: Content-Disposition: inline In-Reply-To: <0be9da18c0ca360773a397de3063d01019ff88d8.1377107508.git.luto@amacapital.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Can't really comment the patch, just a nit: On 08/21, Andy Lutomirski wrote: > > +static bool may_flink(const struct path *path) > +{ > + bool ret; > + struct inode *inode = path->dentry->d_inode; > + > + /* > + * This is racy: I_LINKABLE could be cleared between this check > + * and the actual link operation. OK, > + spin_lock(&inode->i_lock); > + ret = !!(inode->i_state & I_LINKABLE); > + spin_unlock(&inode->i_lock); so why do we need to take a lock ? Oleg.