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)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Wed, 24 Mar 2010 14:40:46 +0000 (10:40 -0400)
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>
net/sunrpc/cache.c

index 3e1ef8bf4dc2c4cabac9de4c82c298d3beee2430..a3f340c8b79a83dccc52b413f517a21ccb91b751 100644 (file)
@@ -1244,8 +1244,10 @@ static int content_open(struct inode *inode, struct file *file,
        if (!cd || !try_module_get(cd->owner))
                return -EACCES;
        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;