]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sunrpc/cache: fix module refcnt leak in a failure path
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 11 Mar 2010 22:08:10 +0000 (14:08 -0800)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Apr 2011 14:53:05 +0000 (16:53 +0200)
commit a5990ea1254cd186b38744507aeec3136a0c1c95 upstream.

Don't forget to release the module refcnt if seq_open() returns failure.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: J. Bruce Fields <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: maximilian attems <max@stro.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/sunrpc/cache.c

index c9966713282a75531388b9d02e408aafef62f933..de1d0bfd6ddc59d525c19cb16b6f96cc576bfcc4 100644 (file)
@@ -1252,8 +1252,10 @@ static int content_open(struct inode *inode, struct file *file)
        struct cache_detail *cd = PDE(inode)->data;
 
        han = __seq_open_private(file, &cache_content_op, sizeof(*han));
-       if (han == NULL)
+       if (han == NULL) {
+               module_put(cd->owner);
                return -ENOMEM;
+       }
 
        han->cd = cd;
        return 0;