From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Slusarz Subject: Re: [PATCH] fs: hardlink creation restrictions Date: Sat, 18 Feb 2012 21:56:26 +0100 Message-ID: <20120218205626.GA26880@joi.lan> References: <20120218193857.GA30985@www.outflux.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Morton , linux-kernel@vger.kernel.org, Randy Dunlap , Alexander Viro , Ingo Molnar , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-hardening@lists.openwall.com To: Kees Cook Return-path: Content-Disposition: inline In-Reply-To: <20120218193857.GA30985@www.outflux.net> Sender: linux-doc-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, Feb 18, 2012 at 11:38:57AM -0800, Kees Cook wrote: > @@ -3052,6 +3119,9 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, > error = mnt_want_write(new_path.mnt); > if (error) > goto out_dput; > + error = may_linkat(&old_path); > + if (error) > + goto out_dput; > error = security_path_link(old_path.dentry, &new_path, new_dentry); > if (error) > goto out_drop_write; You should give up write access after check failure (i.e. goto out_drop_write). Marcin