lkml.org 
[lkml]   [2009]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH 01/15] shmem: do not call fput_filp on an initialized filp
    On Fri, 4 Dec 2009, Eric Paris wrote:

    > fput_filp is supposed to be used when the filp was not used. But in the

    put_filp

    > ifndef CONFIG_MMU case shmem_setup_file could call this one an initialized

    on

    > 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@redhat.com>
    > Acked-by: Miklos Szeredi <miklos@szeredi.hu>

    Thanks,
    Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>

    > ---
    >
    > 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:


    \
     
     \ /
      Last update: 2009-12-05 21:25    [W:4.066 / U:1.408 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site