linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rui Xiang <rui.xiang@huawei.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH RESEND] nfsd: return err directly while allocing failing
Date: Mon, 9 Dec 2013 10:29:28 +0800	[thread overview]
Message-ID: <52A52B08.9040305@huawei.com> (raw)

while nthreads alloc fails, return err value directly
without kfree.

Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
---
 fs/nfsd/nfsctl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7f55517..1fa6b00 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -491,9 +491,10 @@ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size)
 	}
 
 	nthreads = kcalloc(npools, sizeof(int), GFP_KERNEL);
-	rv = -ENOMEM;
-	if (nthreads == NULL)
-		goto out_free;
+	if (nthreads == NULL) {
+		mutex_unlock(&nfsd_mutex);
+		return -ENOMEM;
+	}
 
 	if (size > 0) {
 		for (i = 0; i < npools; i++) {
-- 
1.8.2.2



             reply	other threads:[~2013-12-09  2:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09  2:29 Rui Xiang [this message]
2014-01-06 21:31 ` [PATCH RESEND] nfsd: return err directly while allocing failing J. Bruce Fields

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=52A52B08.9040305@huawei.com \
    --to=rui.xiang@huawei.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).