Received: by 10.192.165.156 with SMTP id m28csp256423imm; Tue, 17 Apr 2018 09:37:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx482AfGbCw8vndraHyTFko3iZF7s7P4lBMpdVW5h0zjzP2kytqW8kEPV7zSusZ5WYxw7j1GF X-Received: by 10.98.207.130 with SMTP id b124mr2642287pfg.9.1523983027704; Tue, 17 Apr 2018 09:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983027; cv=none; d=google.com; s=arc-20160816; b=Mv9la59gzP5Iuekny7LjgE3L7Qd9m3z2GDUayY2VMtRL6zzU7onlUxb624jWhFsVyH eE0pNUF5bF1qKVUdRfySe9rv6q7GNEMoydw5WJLHwT81g4OohOYVD7h3R5FJLndXwPqS nBw/2IiGhxGf+V2A7Pe98dWX/f+04GDoZXtFVbS07aNgYYeeBaxEArGoWRFMl1UWlAZ2 x/kvM0OzYTmZpxbm1Vp+ygpUmznkMws/au0RHly79LkFvjW4WOd54HdR1ns93+UL31wC V5Kc2l8JEnAh6gJGwgW2apDv5GKWst/pGLEQm6qks7UtYnESCy1jNoeAeI9ottXMczaP +myQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0U5ZZooJqLlZAkeUZCqBY3UGwzHDp/0d0Db2JlSrUjk=; b=Vv2hV9SyeU4AF/jyMdy1bBVEA70QZWib3qF3UPMx0i07+GfOpGq8f7bSbi+Y4ZoRRa fgepP3SiH2t5wB4JPiP/Kgbd9q+wrrowOnHYi/tXjU4NIkzCeeMzgEBef+jScH1YPfMk xwRSxCctvrDY22dtDf7r60IQIIWg3q9kz/RiVPz1yNA/vhDiVHitLcck3GoDi71Wq9jf XQw5RSDAZanh2DhuqIJrmN/r425l0Wnl0L7tUn6gKCMyHdRAOFrUl0czXmIV713iTvgC febL0FedgF1XVF3NO4OM+NVGP22DpHve5juh/jCTxu1zE0UlvtqKel7rQXr+ZszzV+Eo 0nzg== ARC-Authentication-Results: i=1; mx.google.com; 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 d81si13230211pfd.210.2018.04.17.09.36.53; Tue, 17 Apr 2018 09:37:07 -0700 (PDT) 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; 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 S1755179AbeDQQHT (ORCPT + 99 others); Tue, 17 Apr 2018 12:07:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35068 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755076AbeDQQHQ (ORCPT ); Tue, 17 Apr 2018 12:07:16 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C103BE66; Tue, 17 Apr 2018 16:07:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Young , Eric Biggers , "J. Bruce Fields" Subject: [PATCH 4.14 42/49] sunrpc: remove incorrect HMAC request initialization Date: Tue, 17 Apr 2018 17:59:21 +0200 Message-Id: <20180417155717.044301920@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers commit f3aefb6a7066e24bfea7fcf1b07907576de69d63 upstream. make_checksum_hmac_md5() is allocating an HMAC transform and doing crypto API calls in the following order: crypto_ahash_init() crypto_ahash_setkey() crypto_ahash_digest() This is wrong because it makes no sense to init() the request before a key has been set, given that the initial state depends on the key. And digest() is short for init() + update() + final(), so in this case there's no need to explicitly call init() at all. Before commit 9fa68f620041 ("crypto: hash - prevent using keyed hashes without setting key") the extra init() had no real effect, at least for the software HMAC implementation. (There are also hardware drivers that implement HMAC-MD5, and it's not immediately obvious how gracefully they handle init() before setkey().) But now the crypto API detects this incorrect initialization and returns -ENOKEY. This is breaking NFS mounts in some cases. Fix it by removing the incorrect call to crypto_ahash_init(). Reported-by: Michael Young Fixes: 9fa68f620041 ("crypto: hash - prevent using keyed hashes without setting key") Fixes: fffdaef2eb4a ("gss_krb5: Add support for rc4-hmac encryption") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 --- 1 file changed, 3 deletions(-) --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -237,9 +237,6 @@ make_checksum_hmac_md5(struct krb5_ctx * ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); - err = crypto_ahash_init(req); - if (err) - goto out; err = crypto_ahash_setkey(hmac_md5, cksumkey, kctx->gk5e->keylength); if (err) goto out;