From: Li Zefan Date: Thu, 11 Mar 2010 22:08:10 +0000 (-0800) Subject: sunrpc/cache: fix module refcnt leak in a failure path X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a5990ea1254cd186b38744507aeec3136a0c1c95;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: J. Bruce Fields Cc: Neil Brown Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: J. Bruce Fields --- 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, 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;