public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn•fujitsu.com>
To: NeilBrown <neilb@suse•de>, "J. Bruce Fields" <bfields@citi•umich.edu>
Cc: David Miller <davem@davemloft•net>,
	LKML <linux-kernel@vger•kernel.org>,
	"netdev@vger•kernel.org" <netdev@vger•kernel.org>
Subject: [PATCH] sunrpc/cache: fix module refcnt leak in a failure path
Date: Tue, 02 Feb 2010 14:48:09 +0800	[thread overview]
Message-ID: <4B67CAA9.4070108@cn.fujitsu.com> (raw)

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

                 reply	other threads:[~2010-02-02  6:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B67CAA9.4070108@cn.fujitsu.com \
    --to=lizf@cn$(echo .)fujitsu.com \
    --cc=bfields@citi$(echo .)umich.edu \
    --cc=davem@davemloft$(echo .)net \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=neilb@suse$(echo .)de \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox