Skip to content

Commit

Permalink
sunrpc/cache: fix module refcnt leak in a failure path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and J. Bruce Fields committed Mar 24, 2010
1 parent 9188525 commit a5990ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a5990ea

Please sign in to comment.