Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4488776ybx; Mon, 4 Nov 2019 14:15:57 -0800 (PST) X-Google-Smtp-Source: APXvYqym9CxXWgpRhMbt13KG1GgYiHase+ssEVGXtmKepHVG3iEVDAaeU1LpfeVxNFENjTCsgNIA X-Received: by 2002:aa7:d397:: with SMTP id x23mr31582868edq.75.1572905757221; Mon, 04 Nov 2019 14:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905757; cv=none; d=google.com; s=arc-20160816; b=MJjAJfLn4VWh2OhjYf9AWuCNILJ+lfK0Coej0iAJOAXpkZQp/a7ZKlv8MoSdUr+hA0 kywTECbUyF8TfkGRL6Qjg+Soi1VvwjJ95+i41P1LH/krhfuMcmkhqum8J1XgMtoKN89u gnG411eHkzM70SgfC8CWM2EGK3k6Kn9t74vc59mK/fTUbXKjjzNT35WF0uBURQMHUXgy Xzx7pDPg3mwi7Yx2nxiWxFk6i4VIdNJCvajqzJ36zB6gis4e2YPfDC32AK0Pj6TjnBgh 44Z0I+xQ9hm1oVgslQmR220AD2fAnHR5D1hFnPOAyhpqnGxUxfwXsNdcN235x9SI5c/u dVDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BZo3ig1MkP24pN2fgVXfwX7R2I66E1ICxKGwYBWKKAc=; b=oBfbvH0VQ9MpCw1gVoMTz8aPi0Ntr2nOQOGGAZu6/NYbRcQwsAO2NThilfErVXuDL9 FAWyTIIMiVEah0z1WLM3Yd95/UafzvfRhzxcgOeqPPoAJQo1338F9Y0QFMtW3JQ3uECc 37h0CsyPAJtI58Bkl+BmTdL2kpLV0wBtcNrA/QO+GFhvRsJSBnNESWUuppVuq/HnXnZU bJmIrfMIUfLHCKANt8/jqtEHnChmDDYxL1Vu4UTJxPerGcjyk/6pDo7jvK6nvGr2YZFc zxn8y2DcT6EpeByubkQCpsafkSY6tvnHe6OX6zcpeQ7kuOPonLr256qJpXPNySenB/PV vfPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gqTO3hXS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 49si8553341edz.9.2019.11.04.14.15.34; Mon, 04 Nov 2019 14:15:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gqTO3hXS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390132AbfKDWHc (ORCPT + 99 others); Mon, 4 Nov 2019 17:07:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389476AbfKDWHa (ORCPT ); Mon, 4 Nov 2019 17:07:30 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09D4C20650; Mon, 4 Nov 2019 22:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905249; bh=BJH77TvvwKUZn6ZNF22Qem34C7k49ButL3RODoE7XnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqTO3hXSS6kLNn89Nh0fCep3yz+omjqW4spGEra4ojuEVhVeCnBA3UsbLuWdiyGRB kgxhX7206KR8s0DH8p0xzEbnXdXxCz9fkNlMOHbKaxJaGTPgLb3MkMA3NqvXgzjKtU J1efnYDG/T4bEaqgvB6HIH4m6cBNxBI0jVxdMXTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Anna Schumaker , Sasha Levin Subject: [PATCH 5.3 079/163] NFSv4: Fix leak of clp->cl_acceptor string Date: Mon, 4 Nov 2019 22:44:29 +0100 Message-Id: <20191104212146.040751976@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever [ Upstream commit 1047ec868332034d1fbcb2fae19fe6d4cb869ff2 ] Our client can issue multiple SETCLIENTID operations to the same server in some circumstances. Ensure that calls to nfs4_proc_setclientid() after the first one do not overwrite the previously allocated cl_acceptor string. unreferenced object 0xffff888461031800 (size 32): comm "mount.nfs", pid 2227, jiffies 4294822467 (age 1407.749s) hex dump (first 32 bytes): 6e 66 73 40 6b 6c 69 6d 74 2e 69 62 2e 31 30 31 nfs@klimt.ib.101 35 67 72 61 6e 67 65 72 2e 6e 65 74 00 00 00 00 5granger.net.... backtrace: [<00000000ab820188>] __kmalloc+0x128/0x176 [<00000000eeaf4ec8>] gss_stringify_acceptor+0xbd/0x1a7 [auth_rpcgss] [<00000000e85e3382>] nfs4_proc_setclientid+0x34e/0x46c [nfsv4] [<000000003d9cf1fa>] nfs40_discover_server_trunking+0x7a/0xed [nfsv4] [<00000000b81c3787>] nfs4_discover_server_trunking+0x81/0x244 [nfsv4] [<000000000801b55f>] nfs4_init_client+0x1b0/0x238 [nfsv4] [<00000000977daf7f>] nfs4_set_client+0xfe/0x14d [nfsv4] [<0000000053a68a2a>] nfs4_create_server+0x107/0x1db [nfsv4] [<0000000088262019>] nfs4_remote_mount+0x2c/0x59 [nfsv4] [<00000000e84a2fd0>] legacy_get_tree+0x2d/0x4c [<00000000797e947c>] vfs_get_tree+0x20/0xc7 [<00000000ecabaaa8>] fc_mount+0xe/0x36 [<00000000f15fafc2>] vfs_kern_mount+0x74/0x8d [<00000000a3ff4e26>] nfs_do_root_mount+0x8a/0xa3 [nfsv4] [<00000000d1c2b337>] nfs4_try_mount+0x58/0xad [nfsv4] [<000000004c9bddee>] nfs_fs_mount+0x820/0x869 [nfs] Fixes: f11b2a1cfbf5 ("nfs4: copy acceptor name from context ... ") Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1406858bae6c9..e1e7d2724b971 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -6058,6 +6058,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, } status = task->tk_status; if (setclientid.sc_cred) { + kfree(clp->cl_acceptor); clp->cl_acceptor = rpcauth_stringify_acceptor(setclientid.sc_cred); put_rpccred(setclientid.sc_cred); } -- 2.20.1