Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943AbZLRGKz (ORCPT ); Fri, 18 Dec 2009 01:10:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751778AbZLRGKy (ORCPT ); Fri, 18 Dec 2009 01:10:54 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:39934 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbZLRGKx (ORCPT ); Fri, 18 Dec 2009 01:10:53 -0500 Date: Fri, 18 Dec 2009 06:10:49 +0000 From: Al Viro To: Roland Dreier Cc: Davide Libenzi , linux-kernel@vger.kernel.org Subject: Re: [PATCH] anonfd: Make file read-only if fops->write is not set Message-ID: <20091218061049.GI18217@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 20 On Thu, Dec 17, 2009 at 09:46:11PM -0800, Roland Dreier wrote: > diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c > index 2c99459..097f91f 100644 > --- a/fs/anon_inodes.c > +++ b/fs/anon_inodes.c > @@ -121,13 +121,13 @@ struct file *anon_inode_getfile(const char *name, > d_instantiate(path.dentry, anon_inode_inode); > > error = -ENFILE; > - file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops); > + file = alloc_file(&path, FMODE_READ | (fops->write ? FMODE_WRITE : 0), fops); Good grief, what for? We are already passing O_NDELAY in flags argument, why not add O_RDWR/O_RDONLY to it? It's not as if we had that many callers, after all... -- 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/