Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp902881ybc; Tue, 12 Nov 2019 11:02:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwWNfzfEIOFB0GhGLfcLJNVtMA3nQzRnfS7SAvQVsJLWPCqfUe0HHpK13BRS8P1vlT7xxRq X-Received: by 2002:a17:907:20d2:: with SMTP id qq18mr29844436ejb.305.1573585342273; Tue, 12 Nov 2019 11:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573585342; cv=none; d=google.com; s=arc-20160816; b=OaRZ93roV1vqbCQQ1fa98JIf966q1Zh0NyEIyw2rEFPAKJbSbVuMkpvEdWJ0AVI7Vu ykJZTvVv35CGqOOevQb06QC1bMYcyxxiiFWVvViOdkmj7EVAI/0fRF9e73LcVfIqel9Z a0tT6W5qBzL/FSUrdl1GvjjJUKCQgH9Zdwt4pX1TuVhimn0slmvyssNfThCtAva+LueX 2X39TJcsBavdy90DZUw4GvN9pWS+eQ00+NMSm7SOqBzq675T/MErI3URukKUge9S479s f1pIFHor/TonQ/HecSn4WKqhwGSB68z01YMnKBu1IJ/NoGkN6W6TaOecBG85lo8iD/KG vf9A== 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:message-id:date :subject:cc:to:from:dkim-signature; bh=k/hnq3/fW/qgmBi4iP95zyWmQjHxmDKK3flFUTul5T4=; b=fsGhyPcZzMYD5F5J3kH19Psrv0C+GjUnEpS6XWCWQTtjOitmMh9N4zGvlzGAbCvyXp J/XPby+9pJX6TKn5HvUg0B+hecA2bvV73qy08had4Q9eW95WJaZBItfkW0ynU1RNJopN UWFSZDuosfvq0jni2pHiGIgjNdU1Pnn9KYiBH/u3RRsva7a1TQDCFkat+xvF+4EGqEqR IPzgj2VrVSbdrF1ejDhW/JQAROtGtWwe5kxtRgBFSTG5XoyguQbGehseyc+hE2RhH5f1 WMep+zjaacYMSRRUDIXo9Y1tFzJtZokS9wkUF9xvaWetKXcJSOvwrSLERVCvU4zG2oVI gyBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E13vTFcl; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si611703ejc.266.2019.11.12.11.01.55; Tue, 12 Nov 2019 11:02:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@redhat.com header.s=mimecast20190719 header.b=E13vTFcl; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbfKLTBu (ORCPT + 99 others); Tue, 12 Nov 2019 14:01:50 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:22679 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726952AbfKLTBt (ORCPT ); Tue, 12 Nov 2019 14:01:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573585308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k/hnq3/fW/qgmBi4iP95zyWmQjHxmDKK3flFUTul5T4=; b=E13vTFclv1jU4r7gI7oradIrb1rtV+mLCkdYoloWNMtk/07AAYjahHgxeAQUC1G7huIlMK hBHJmZF3mrYLeZgELDOUK/ny6oX/JFY35ZgpLIBWybrnjMRmv8P1s0nRYWMPuWHX9L1HqJ xsQw0rpZ6SSR7omlbxwduyzeIfn1NQc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-BRX-MoWtO4aWGSdXq6Vxhg-1; Tue, 12 Nov 2019 14:01:45 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B22B31007272; Tue, 12 Nov 2019 19:01:44 +0000 (UTC) Received: from coeurl.usersys.redhat.com (ovpn-122-210.rdu2.redhat.com [10.10.122.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4761328DD0; Tue, 12 Nov 2019 19:01:44 +0000 (UTC) Received: by coeurl.usersys.redhat.com (Postfix, from userid 1000) id DAB9D208EC; Tue, 12 Nov 2019 14:01:43 -0500 (EST) From: Scott Mayhew To: bfields@fieldses.org, chuck.lever@oracle.com Cc: jamie@audible.transient.net, linux-nfs@vger.kernel.org Subject: [PATCH v3] nfsd: Fix cld_net->cn_tfm initialization Date: Tue, 12 Nov 2019 14:01:43 -0500 Message-Id: <20191112190143.12624-1-smayhew@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: BRX-MoWtO4aWGSdXq6Vxhg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- fs/nfsd/nfs4recover.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index cdc75ad4438b..c35c0ebaf722 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net) =09struct nfsd_net *nn =3D net_generic(net, nfsd_net_id); =09bool running; =09int retries =3D 10; +=09struct crypto_shash *tfm; =20 =09status =3D nfs4_cld_state_init(net); =09if (status) @@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net) =09status =3D __nfsd4_init_cld_pipe(net); =09if (status) =09=09goto err_shutdown; -=09nn->cld_net->cn_tfm =3D crypto_alloc_shash("sha256", 0, 0); -=09if (IS_ERR(nn->cld_net->cn_tfm)) { -=09=09status =3D PTR_ERR(nn->cld_net->cn_tfm); -=09=09goto err_remove; -=09} =20 =09/* =09 * 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) =09=09status =3D -ETIMEDOUT; =09=09goto err_remove; =09} +=09tfm =3D crypto_alloc_shash("sha256", 0, 0); +=09if (IS_ERR(tfm)) { +=09=09status =3D PTR_ERR(tfm); +=09=09goto err_remove; +=09} +=09nn->cld_net->cn_tfm =3D tfm; =20 =09status =3D nfsd4_cld_get_version(nn); =09if (status =3D=3D -EOPNOTSUPP) --=20 2.17.2