lkml.org 
[lkml]   [2008]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/4] proc: proc_get_inode should get module only once
    Date
    Any file under /proc/net opened more than once leaked the refcounter
    on the module it belongs to.

    The problem is that module_get is called for each file opening while
    module_put is called only when /proc inode is destroyed. So, lets put
    module counter if we are dealing with already initialised inode.

    Signed-off-by: Denis V. Lunev <den@openvz.org>
    Cc: David Miller <davem@davemloft.net>
    Cc: Patrick McHardy <kaber@trash.net>
    Acked-by: Pavel Emelyanov <xemul@openvz.org>
    Acked-by: Robert Olsson <robert.olsson@its.uu.se>
    Acked-by: Eric W. Biederman <ebiederm@xmission.com>
    ---
    fs/proc/inode.c | 3 ++-
    1 files changed, 2 insertions(+), 1 deletions(-)

    diff --git a/fs/proc/inode.c b/fs/proc/inode.c
    index 6f4e8dc..b08d100 100644
    --- a/fs/proc/inode.c
    +++ b/fs/proc/inode.c
    @@ -425,7 +425,8 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
    }
    }
    unlock_new_inode(inode);
    - }
    + } else
    + module_put(de->owner);
    return inode;

    out_ino:
    --
    1.5.3.rc5


    \
     
     \ /
      Last update: 2008-05-20 12:05    [W:0.018 / U:98.380 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site