public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] sunrpc/cache: fix module refcnt leak in a failure path
@ 2010-02-02  6:48 Li Zefan
  0 siblings, 0 replies; only message in thread
From: Li Zefan @ 2010-02-02  6:48 UTC (permalink / raw)
  To: NeilBrown, J. Bruce Fields; +Cc: David Miller, LKML, netdev@vger•kernel.org

Don't forget to release the module refcnt if seq_open()
returns failure.

Signed-off-by: Li Zefan <lizf@cn•fujitsu.com>
---
 net/sunrpc/cache.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 39bddba..b7af6b2 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1233,8 +1233,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;
-- 
1.6.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-02  6:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02  6:48 [PATCH] sunrpc/cache: fix module refcnt leak in a failure path Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox