Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8502693ybl; Thu, 16 Jan 2020 18:14:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzrxN2FO9sCYMN08VRB+98E0Yqa2ajSENJOQnrNVQVg6YDZ75lG/zRkMUlkNMm3YvsgLuCJ X-Received: by 2002:aca:5fc6:: with SMTP id t189mr1833003oib.166.1579227287959; Thu, 16 Jan 2020 18:14:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579227287; cv=none; d=google.com; s=arc-20160816; b=kqV0kP6QD2zi/hH3Ers8CQiBbTf5PvLgiYu1OOCSXqy5d1XWd/99kpryYZRxHlpRlt 87D8jZ1U/OeAerc0tZe1G7L/kN/ur1qsXiAQJjF0gVA4+fLSe2fk69qOaBL2tM8Hlzkw bThmlE5oDcgAEPLXclBn8WerSXUu1zdxk2dKP4JzX05lfA00r0dt4u3UDkQ1H/gq2DMZ z9xOy4RONoCtpJNxXf69imHaVpk52UbD/NwFAEAa468VdVSLwCvlS93gicAZgzneblvs 7EW2E6T+KixD//LCPxcH5pxUK0hX4kt+R26qo88eCxLXBH+6Jfu0gcEbug6MefrifOSV fkdg== 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=Egy5kO92fyjcyqiAn2aI4ZT7rY3Uaia1pvoGAu6oQ34=; b=ahKgrrJturJRl4vjeskU+5XMV663CWpTVS3BZd6+7gpN7tuIRQMg11u4Iy1mpBECme TkWy0b5s7rqwi1HpTY2cPEesdg+itLgwmI6CROBaDkw08YScREMKkS4x9FnTaYqkSFxN AIYhLBhnogQkKrEt5qHBgqXpxYAL8+4nwjNx5NUn6Zkm01KrLjHrbzEbUwA/IXZSgWgz cGpwTfG4j7dfoVIm6AgsXIYKD8SdskLditWr7XOQhTFbf7vWJ07qUyHW2tTVxhXCtLO2 zRERTg6zR+/Qr2s2xSqZuc+/DHMwxHmKSGq9K5IpLU5uhbKBvZA95+tZXe0xKR8WdFGr 9e0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPxCudQ8; 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 g10si14442882otn.12.2020.01.16.18.14.36; Thu, 16 Jan 2020 18:14:47 -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=CPxCudQ8; 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 S1732456AbgAPXX5 (ORCPT + 99 others); Thu, 16 Jan 2020 18:23:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:52668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729794AbgAPXX4 (ORCPT ); Thu, 16 Jan 2020 18:23:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DC201206D9; Thu, 16 Jan 2020 23:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217035; bh=zxMwx2OtgXRt1znZy60Yrg+tBGsBd59R2bQKe67uDE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPxCudQ8sbjoRp1c9qRHf9ORESqhCcA70eyZJrYJhms6EvLSb0Y5X3Ueh7IWr08ry xbch6Xx0vNddMqi37h746pDJvab/+62KoRYdMt2AtJtMkQkClBgBTJranqOEl9iUb2 CTTH7pKkJRDFpMIrBNVRuOdkynuYWCln5rbsllvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jamie Heilman , Scott Mayhew , "J. Bruce Fields" Subject: [PATCH 5.4 105/203] nfsd: Fix cld_net->cn_tfm initialization Date: Fri, 17 Jan 2020 00:17:02 +0100 Message-Id: <20200116231754.736665919@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@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: Scott Mayhew commit 18b9a895e652979b70f9c20565394a69354dfebc upstream. Don't assign an error pointer to cld_net->cn_tfm, otherwise an oops will occur in nfsd4_remove_cld_pipe(). Also, move the initialization of cld_net->cn_tfm so that it occurs after the check to see if nfsdcld is running. This is necessary because nfsd4_client_tracking_init() looks for -ETIMEDOUT to determine whether to use the "old" nfsdcld tracking ops. Fixes: 6ee95d1c8991 ("nfsd: add support for upcall version 2") Reported-by: Jamie Heilman Signed-off-by: Scott Mayhew Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4recover.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net) struct nfsd_net *nn = net_generic(net, nfsd_net_id); bool running; int retries = 10; + struct crypto_shash *tfm; status = nfs4_cld_state_init(net); if (status) @@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net) status = __nfsd4_init_cld_pipe(net); if (status) goto err_shutdown; - nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0); - if (IS_ERR(nn->cld_net->cn_tfm)) { - status = PTR_ERR(nn->cld_net->cn_tfm); - goto err_remove; - } /* * rpc pipe upcalls take 30 seconds to time out, so we don't want to @@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net) status = -ETIMEDOUT; goto err_remove; } + tfm = crypto_alloc_shash("sha256", 0, 0); + if (IS_ERR(tfm)) { + status = PTR_ERR(tfm); + goto err_remove; + } + nn->cld_net->cn_tfm = tfm; status = nfsd4_cld_get_version(nn); if (status == -EOPNOTSUPP)