Skip to contentSkip to conversation

sunrpc/cache: fix module refcnt leak in a failure path

PATCH New Li Zefan 1 participant 1 message Feb 2, 2010

Subsystems (4)
lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 sunrpc/cache: fix module refcnt leak in a failure path

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

---
 net/sunrpc/cache.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/sunrpc/cache.c +3 -1
index 39bddba..b7af6b2 100644
@@ -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;
Signature · 1 line
1.6.3