[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091204204646.18286.24853.stgit@paris.rdu.redhat.com>
Date: Fri, 04 Dec 2009 15:46:46 -0500
From: Eric Paris <eparis@...hat.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Cc: viro@...iv.linux.org.uk, jmorris@...ei.org, npiggin@...e.de,
eparis@...hat.com, zohar@...ibm.com, jack@...e.cz,
jmalicki@...acarta.com, dsmith@...hat.com, serue@...ibm.com,
hch@....de, john@...nmccutchan.com, rlove@...ve.org,
ebiederm@...ssion.com, heiko.carstens@...ibm.com,
penguin-kernel@...ove.SAKURA.ne.jp, mszeredi@...e.cz,
jens.axboe@...cle.com, akpm@...ux-foundation.org, matthew@....cx,
hugh.dickins@...cali.co.uk, kamezawa.hiroyu@...fujitsu.com,
nishimura@....nes.nec.co.jp, davem@...emloft.net, arnd@...db.de,
eric.dumazet@...il.com
Subject: [RFC PATCH 01/15] shmem: do not call fput_filp on an initialized filp
fput_filp is supposed to be used when the filp was not used. But in the
ifndef CONFIG_MMU case shmem_setup_file could call this one an initialized
filp. It should be using fput() instead. Since the fput() will dec the ima
counts we also need to move the ima hook to make sure that is set up before
the fput().
Signed-off-by: Eric Paris <eparis@...hat.com>
Acked-by: Miklos Szeredi <miklos@...redi.hu>
---
mm/shmem.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 356dd99..e7f8968 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2656,12 +2656,15 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
&shmem_file_operations);
+ ima_counts_get(file);
+
#ifndef CONFIG_MMU
error = ramfs_nommu_expand_for_mapping(inode, size);
- if (error)
- goto close_file;
+ if (error) {
+ fput(file);
+ return error;
+ }
#endif
- ima_counts_get(file);
return file;
close_file:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists