aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/cache.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-03-11 17:08:10 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-03-24 10:40:46 -0400
commita5990ea1254cd186b38744507aeec3136a0c1c95 (patch)
treed194df4b090b30d28075ac02f39a3dbc10628a2f /net/sunrpc/cache.c
parent91885258e8343bb65c08f668d7e6c16563eb4284 (diff)
sunrpc/cache: fix module refcnt leak in a failure path
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>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r--net/sunrpc/cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 3e1ef8bf4dc2..a3f340c8b79a 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1244,8 +1244,10 @@ static int content_open(struct inode *inode, struct file *file,
1244 if (!cd || !try_module_get(cd->owner)) 1244 if (!cd || !try_module_get(cd->owner))
1245 return -EACCES; 1245 return -EACCES;
1246 han = __seq_open_private(file, &cache_content_op, sizeof(*han)); 1246 han = __seq_open_private(file, &cache_content_op, sizeof(*han));
1247 if (han == NULL) 1247 if (han == NULL) {
1248 module_put(cd->owner);
1248 return -ENOMEM; 1249 return -ENOMEM;
1250 }
1249 1251
1250 han->cd = cd; 1252 han->cd = cd;
1251 return 0; 1253 return 0;