From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael Kerrisk" Subject: Re: [parch 4/4] vfs: utimensat(): fix write access check for futimens() Date: Wed, 4 Jun 2008 10:43:12 +0200 Message-ID: References: <4845C4D2.8050408@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, hch@lst.de, viro@zeniv.linux.org.uk, jamie@shareable.org, drepper@redhat.com, linux-fsdevel@vger.kernel.org, subrata@linux.vnet.ibm.com To: "Miklos Szeredi" Return-path: Received: from qb-out-0506.google.com ([72.14.204.225]:30465 "EHLO qb-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752195AbYFDInN (ORCPT ); Wed, 4 Jun 2008 04:43:13 -0400 Received: by qb-out-0506.google.com with SMTP id q10so5551884qbq.15 for ; Wed, 04 Jun 2008 01:43:12 -0700 (PDT) In-Reply-To: Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Jun 4, 2008 at 7:54 AM, Miklos Szeredi wrote: >> At which point the "if (f)" and the "else" branches become equivalent >> (the nameidata isn't interesting in the other case either). So that >> could be written as: >> >> if (!is_owner_or_cap(inode)) { >> error = permission(inode, MAY_WRITE, NULL); >> if (error) >> goto mnt_drop_write_and_out; >> } > > And also the IS_IMMUTABLE() check can be removed, since it's checked > by permission(MAY_WRITE) anyway. I'm not sure that that is true, because immutability applies regardless of capabilities or ownership, right? -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html