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-Tag: v2.6.27.59~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3551c1c874fbc3a576ffc88541f686422d18c21;p=thirdparty%2Fkernel%2Fstable.git sunrpc/cache: fix module refcnt leak in a failure path commit a5990ea1254cd186b38744507aeec3136a0c1c95 upstream. 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 Cc: maximilian attems Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index c9966713282a7..de1d0bfd6ddc5 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1252,8 +1252,10 @@ static int content_open(struct inode *inode, struct file *file) struct cache_detail *cd = PDE(inode)->data; 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;