From: Ashish Sangwan Subject: [PATCH] vfs: no need to check about IS_IMMUTABLE in do_fallocate Date: Sat, 27 Apr 2013 10:12:19 +0530 Message-ID: <1367037739-2017-1-git-send-email-ashish.sangwan2@gmail.com> Cc: linux-fsdevel@vger.kernel.org, Ashish Sangwan , Namjae Jeon To: viro@zeniv.linux.org.uk Return-path: Received: from mail-pd0-f181.google.com ([209.85.192.181]:38260 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813Ab3D0EnB (ORCPT ); Sat, 27 Apr 2013 00:43:01 -0400 Received: by mail-pd0-f181.google.com with SMTP id q10so424225pdj.12 for ; Fri, 26 Apr 2013 21:43:00 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Ashish Sangwan In do_fallocate, first there is check for FMODE_WRITE and after that there is second check for IS_IMMUTABLE. A file cannot be opened in write mode if the corresponding inode is immutable, hence the second check is not required. Signed-off-by: Ashish Sangwan Signed-off-by: Namjae Jeon --- fs/open.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/fs/open.c b/fs/open.c index 8c74100..939e402 100644 --- a/fs/open.c +++ b/fs/open.c @@ -245,9 +245,6 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) if (mode & FALLOC_FL_PUNCH_HOLE && IS_APPEND(inode)) return -EPERM; - if (IS_IMMUTABLE(inode)) - return -EPERM; - /* * Revalidate the write permissions, in case security policy has * changed since the files were opened. -- 1.7.8.4