* [PATCH RESEND] nfsd: return err directly while allocing failing
@ 2013-12-09 2:29 Rui Xiang
2014-01-06 21:31 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Rui Xiang @ 2013-12-09 2:29 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-nfs
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] nfsd: return err directly while allocing failing
2013-12-09 2:29 [PATCH RESEND] nfsd: return err directly while allocing failing Rui Xiang
@ 2014-01-06 21:31 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2014-01-06 21:31 UTC (permalink / raw)
To: Rui Xiang; +Cc: linux-nfs
On Mon, Dec 09, 2013 at 10:29:28AM +0800, Rui Xiang wrote:
> while nthreads alloc fails, return err value directly
> without kfree.
This doesn't fix any problem that I can see, since kfree(NULL) is
defined to be a no-op.
--b.
>
> 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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-06 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 2:29 [PATCH RESEND] nfsd: return err directly while allocing failing Rui Xiang
2014-01-06 21:31 ` J. Bruce Fields
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).