Return-Path: linux-nfs-owner@vger.kernel.org Received: from mx2.netapp.com ([216.240.18.37]:10118 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754574Ab2BPUoZ (ORCPT ); Thu, 16 Feb 2012 15:44:25 -0500 Received: from svlrsexc1-prd.hq.netapp.com (svlrsexc1-prd.hq.netapp.com [10.57.115.30]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q1GKiLCl025757 for ; Thu, 16 Feb 2012 12:44:21 -0800 (PST) From: "Adamson, Dros" To: "Myklebust, Trond" CC: "Adamson, Dros" , "linux-nfs@vger.kernel.org" Subject: Re: [PATCH 2/3] NFSv4: fix server_scope memory leak Date: Thu, 16 Feb 2012 20:44:15 +0000 Message-ID: <901DD1C3-FEE4-437C-B7E8-C0568B96D949@netapp.com> References: <1329409026-20466-1-git-send-email-dros@netapp.com> <1329409026-20466-2-git-send-email-dros@netapp.com> <1329424993.19793.12.camel@lade.trondhjem.org> In-Reply-To: <1329424993.19793.12.camel@lade.trondhjem.org> Content-Type: multipart/signed; boundary="Apple-Mail=_E674A939-EC1E-42BB-AE8A-2959EDCA5051"; protocol="application/pkcs7-signature"; micalg=sha1 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org List-ID: --Apple-Mail=_E674A939-EC1E-42BB-AE8A-2959EDCA5051 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Feb 16, 2012, at 3:43 PM, Myklebust, Trond wrote: > On Thu, 2012-02-16 at 11:17 -0500, Weston Andros Adamson wrote: >> server_scope would never be freed if nfs4_check_cl_exchange_flags() = returned >> non-zero >>=20 >> Signed-off-by: Weston Andros Adamson >> --- >> fs/nfs/nfs4proc.c | 15 +++++++++------ >> 1 files changed, 9 insertions(+), 6 deletions(-) >>=20 >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> index 87c584d..20c3bb0 100644 >> --- a/fs/nfs/nfs4proc.c >> +++ b/fs/nfs/nfs4proc.c >> @@ -4945,8 +4945,10 @@ int nfs4_proc_exchange_id(struct nfs_client = *clp, struct rpc_cred *cred) >> clp->cl_rpcclient->cl_auth->au_flavor); >>=20 >> res.server_scope =3D kzalloc(sizeof(struct server_scope), = GFP_KERNEL); >> - if (unlikely(!res.server_scope)) >> - return -ENOMEM; >> + if (unlikely(!res.server_scope)) { >> + status =3D -ENOMEM; >> + goto out; >> + } >>=20 >> status =3D rpc_call_sync(clp->cl_rpcclient, &msg, = RPC_TASK_TIMEOUT); >> if (!status) >> @@ -4963,12 +4965,13 @@ int nfs4_proc_exchange_id(struct nfs_client = *clp, struct rpc_cred *cred) >> clp->server_scope =3D NULL; >> } >>=20 >> - if (!clp->server_scope) >> + if (!clp->server_scope) { >> clp->server_scope =3D res.server_scope; >> - else >> - kfree(res.server_scope); >> + goto out; >> + } >> } >> - >> + kfree(res.server_scope); >> +out: >> dprintk("<-- %s status=3D %d\n", __func__, status); >> return status; >> } >=20 > This looks like it is a bug in existing kernels. Should I queue it up > for stable@vger.kernel.org? Yes, I should have mentioned that! -dros --Apple-Mail=_E674A939-EC1E-42BB-AE8A-2959EDCA5051 Content-Disposition: attachment; filename="smime.p7s" Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIDTzCCA0sw ggIzoAMCAQICAQEwCwYJKoZIhvcNAQEFMEYxFzAVBgNVBAMMDldlc3RvbiBBZGFtc29uMQswCQYD VQQGEwJVUzEeMBwGCSqGSIb3DQEJARYPZHJvc0BuZXRhcHAuY29tMB4XDTExMDYwODIyMDc0NloX DTEyMDYwNzIyMDc0NlowRjEXMBUGA1UEAwwOV2VzdG9uIEFkYW1zb24xCzAJBgNVBAYTAlVTMR4w HAYJKoZIhvcNAQkBFg9kcm9zQG5ldGFwcC5jb20wggEiMA0GCSqGSIb3DQEBAQUA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