* [PATCH] NFS: put net in case of idr allocation failure
@ 2012-08-20 13:43 Stanislav Kinsbursky
2012-08-20 16:11 ` Myklebust, Trond
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Kinsbursky @ 2012-08-20 13:43 UTC (permalink / raw)
To: Trond.Myklebust; +Cc: bfields, linux-nfs, linux-kernel, devel
Put net reference we got in nfs_alloc_client() on error path.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
---
fs/nfs/nfs4client.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index cbcdfaf..b895629 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -74,6 +74,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
return clp;
error:
+ put_net(clp->cl_net);
kfree(clp);
return ERR_PTR(err);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] NFS: put net in case of idr allocation failure
2012-08-20 13:43 [PATCH] NFS: put net in case of idr allocation failure Stanislav Kinsbursky
@ 2012-08-20 16:11 ` Myklebust, Trond
0 siblings, 0 replies; 4+ messages in thread
From: Myklebust, Trond @ 2012-08-20 16:11 UTC (permalink / raw)
To: Stanislav Kinsbursky
Cc: bfields@fieldses.org, linux-nfs@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@openvz.org
T24gTW9uLCAyMDEyLTA4LTIwIGF0IDE3OjQzICswNDAwLCBTdGFuaXNsYXYgS2luc2J1cnNreSB3
cm90ZToNCj4gUHV0IG5ldCByZWZlcmVuY2Ugd2UgZ290IGluIG5mc19hbGxvY19jbGllbnQoKSBv
biBlcnJvciBwYXRoLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogU3RhbmlzbGF2IEtpbnNidXJza3kg
PHNraW5zYnVyc2t5QHBhcmFsbGVscy5jb20+DQo+IC0tLQ0KPiAgZnMvbmZzL25mczRjbGllbnQu
YyB8ICAgIDE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allocation failure
@ 2012-08-20 16:11 ` Myklebust, Trond
0 siblings, 0 replies; 4+ messages in thread
From: Myklebust, Trond @ 2012-08-20 16:11 UTC (permalink / raw)
To: Stanislav Kinsbursky
Cc: bfields@fieldses.org, linux-nfs@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@openvz.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1104 bytes --]
On Mon, 2012-08-20 at 17:43 +0400, Stanislav Kinsbursky wrote:
> Put net reference we got in nfs_alloc_client() on error path.
>
> Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
> ---
> fs/nfs/nfs4client.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
> index cbcdfaf..b895629 100644
> --- a/fs/nfs/nfs4client.c
> +++ b/fs/nfs/nfs4client.c
> @@ -74,6 +74,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
> return clp;
>
> error:
> + put_net(clp->cl_net);
> kfree(clp);
> return ERR_PTR(err);
> }
No, that isn't anywhere near sufficient.
The correct thing to do here is to replace the kfree with a call to
nfs_free_client(), which will also clean up the allocation of
cl_hostname, put the module, etc.
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@netapp.com
www.netapp.com
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] NFS: put net in case of idr allocation failure
2012-08-20 16:11 ` Myklebust, Trond
(?)
@ 2012-08-20 16:14 ` Stanislav Kinsbursky
-1 siblings, 0 replies; 4+ messages in thread
From: Stanislav Kinsbursky @ 2012-08-20 16:14 UTC (permalink / raw)
To: Myklebust, Trond
Cc: bfields@fieldses.org, linux-nfs@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@openvz.org
20.08.2012 20:11, Myklebust, Trond пишет:
> On Mon, 2012-08-20 at 17:43 +0400, Stanislav Kinsbursky wrote:
>> Put net reference we got in nfs_alloc_client() on error path.
>>
>> Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
>> ---
>> fs/nfs/nfs4client.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
>> index cbcdfaf..b895629 100644
>> --- a/fs/nfs/nfs4client.c
>> +++ b/fs/nfs/nfs4client.c
>> @@ -74,6 +74,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
>> return clp;
>>
>> error:
>> + put_net(clp->cl_net);
>> kfree(clp);
>> return ERR_PTR(err);
>> }
>
>
> No, that isn't anywhere near sufficient.
>
> The correct thing to do here is to replace the kfree with a call to
> nfs_free_client(), which will also clean up the allocation of
> cl_hostname, put the module, etc.
>
Sure, you are right.
--
Best regards,
Stanislav Kinsbursky
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-20 16:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 13:43 [PATCH] NFS: put net in case of idr allocation failure Stanislav Kinsbursky
2012-08-20 16:11 ` Myklebust, Trond
2012-08-20 16:11 ` Myklebust, Trond
2012-08-20 16:14 ` Stanislav Kinsbursky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.