Commit a5990ea1 authored by Li Zefan's avatar Li Zefan Committed by J. Bruce Fields

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: default avatarLi 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 91885258
...@@ -1244,8 +1244,10 @@ static int content_open(struct inode *inode, struct file *file, ...@@ -1244,8 +1244,10 @@ static int content_open(struct inode *inode, struct file *file,
if (!cd || !try_module_get(cd->owner)) if (!cd || !try_module_get(cd->owner))
return -EACCES; return -EACCES;
han = __seq_open_private(file, &cache_content_op, sizeof(*han)); han = __seq_open_private(file, &cache_content_op, sizeof(*han));
if (han == NULL) if (han == NULL) {
module_put(cd->owner);
return -ENOMEM; return -ENOMEM;
}
han->cd = cd; han->cd = cd;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment