Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6284904imu; Mon, 21 Jan 2019 06:22:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN62nH1HJh7eHzdyNyB2M2oGrF6ApSEgmE0c7MJtl4g2Nv1Nqp119E0kbUntQ/qiOuIRaSEt X-Received: by 2002:a17:902:ab84:: with SMTP id f4mr29689479plr.207.1548080563487; Mon, 21 Jan 2019 06:22:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548080563; cv=none; d=google.com; s=arc-20160816; b=pGwmB28IEKkHav6Nn1ISHDV5mzUjRa/6jQAI0Xj1A/SAwHxBYLr1ZU/oM9qwLeDBmH Wo945t6sUPgqTo5bKqEf6nFADOqy1EuzrL7aWGyyDVR4Y5VrJS5hMPiMxH5JR15sZOQy eNAaDFWZYIPtOmdF0QGWMY2RINsbNGalGQDOAw9ZZA+S+6m/L8QWSsSOqDY9Y43o+fGX iWW5ZXOPyZfJnbqL0dwvv/5oJM0iiFfg8M2vUVETyNB7OiP9V6q+28qpv54NAiodEbT6 6UbRbUzmttP87sBH1DvKo+LzkNpScA3pLhcasQYES303ybFMtMFpypOQ0xn62+msZjqR OpRQ== 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=ji8/QXjKQVO5OibSSglU3FlmZevKeCIUi47zW3YwuMI=; b=N5r2Xu6PBQZGsHGPx86wSjN3SoFqCi+0cGgHEBx7wASwVlYtMK4FBoDj7cinm5lREr iIr+6RbMjLKvFqW5DJvx20UvMg9hNyEM8Wdaqt0rH4idCYaGg2xrkOU0hj5RGv4VzE3o bV5KxQVMvsknCRL3c8CeC1U3VaciiYQi6rKCHopLIpa0FvndgjjxJGkapx7VB7GPaDu6 SFVvObwoQRQPtejIbiWiEzlrZpa6tEDMyGJ2MZptYOPYvg++H1aXyymXMvg+G4cGfjaB J8sWCbgw4zLCxjAGyrKjcc49+ZY4AkqX5UcwFGYpthHUf9fWoUH8ng1gIfoxJujTEgXy 5CJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCDaT8DL; 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 n3si13093128pld.36.2019.01.21.06.22.28; Mon, 21 Jan 2019 06:22:43 -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=jCDaT8DL; 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 S1730141AbfAUOU7 (ORCPT + 99 others); Mon, 21 Jan 2019 09:20:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:56780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728975AbfAUNr0 (ORCPT ); Mon, 21 Jan 2019 08:47:26 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 08CCB2089F; Mon, 21 Jan 2019 13:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078445; bh=My+9r6ZEgIo77rbGS3FpXGVqF4v40PAREVKK1r1T+1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCDaT8DLLIDKe3nnvbukRQMokN2pvoZnfLtWOmxKn8iqeTvdQOHC/9s2W2lrYr47+ T5BWv1pNuZ6z2ok/3+1BnCxaaO8xy0ilTL0z5o3mDw0dIXBCja+FZo2D7d+W9AsO4v 1Am6VJ2Pm2ubGI6EQTNskJwp6H2GNT0rCoZ8PkOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harsh Jain , Herbert Xu Subject: [PATCH 4.20 034/111] crypto: authencesn - Avoid twice completion call in decrypt path Date: Mon, 21 Jan 2019 14:42:28 +0100 Message-Id: <20190121122459.653520580@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Harsh Jain commit a7773363624b034ab198c738661253d20a8055c2 upstream. Authencesn template in decrypt path unconditionally calls aead_request_complete after ahash_verify which leads to following kernel panic in after decryption. [ 338.539800] BUG: unable to handle kernel NULL pointer dereference at 0000000000000004 [ 338.548372] PGD 0 P4D 0 [ 338.551157] Oops: 0000 [#1] SMP PTI [ 338.554919] CPU: 0 PID: 0 Comm: swapper/0 Kdump: loaded Tainted: G W I 4.19.7+ #13 [ 338.564431] Hardware name: Supermicro X8ST3/X8ST3, BIOS 2.0 07/29/10 [ 338.572212] RIP: 0010:esp_input_done2+0x350/0x410 [esp4] [ 338.578030] Code: ff 0f b6 68 10 48 8b 83 c8 00 00 00 e9 8e fe ff ff 8b 04 25 04 00 00 00 83 e8 01 48 98 48 8b 3c c5 10 00 00 00 e9 f7 fd ff ff <8b> 04 25 04 00 00 00 83 e8 01 48 98 4c 8b 24 c5 10 00 00 00 e9 3b [ 338.598547] RSP: 0018:ffff911c97803c00 EFLAGS: 00010246 [ 338.604268] RAX: 0000000000000002 RBX: ffff911c4469ee00 RCX: 0000000000000000 [ 338.612090] RDX: 0000000000000000 RSI: 0000000000000130 RDI: ffff911b87c20400 [ 338.619874] RBP: 0000000000000000 R08: ffff911b87c20498 R09: 000000000000000a [ 338.627610] R10: 0000000000000001 R11: 0000000000000004 R12: 0000000000000000 [ 338.635402] R13: ffff911c89590000 R14: ffff911c91730000 R15: 0000000000000000 [ 338.643234] FS: 0000000000000000(0000) GS:ffff911c97800000(0000) knlGS:0000000000000000 [ 338.652047] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 338.658299] CR2: 0000000000000004 CR3: 00000001ec20a000 CR4: 00000000000006f0 [ 338.666382] Call Trace: [ 338.669051] [ 338.671254] esp_input_done+0x12/0x20 [esp4] [ 338.675922] chcr_handle_resp+0x3b5/0x790 [chcr] [ 338.680949] cpl_fw6_pld_handler+0x37/0x60 [chcr] [ 338.686080] chcr_uld_rx_handler+0x22/0x50 [chcr] [ 338.691233] uldrx_handler+0x8c/0xc0 [cxgb4] [ 338.695923] process_responses+0x2f0/0x5d0 [cxgb4] [ 338.701177] ? bitmap_find_next_zero_area_off+0x3a/0x90 [ 338.706882] ? matrix_alloc_area.constprop.7+0x60/0x90 [ 338.712517] ? apic_update_irq_cfg+0x82/0xf0 [ 338.717177] napi_rx_handler+0x14/0xe0 [cxgb4] [ 338.722015] net_rx_action+0x2aa/0x3e0 [ 338.726136] __do_softirq+0xcb/0x280 [ 338.730054] irq_exit+0xde/0xf0 [ 338.733504] do_IRQ+0x54/0xd0 [ 338.736745] common_interrupt+0xf/0xf Fixes: 104880a6b470 ("crypto: authencesn - Convert to new AEAD...") Signed-off-by: Harsh Jain Cc: stable@vger.kernel.org Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/authencesn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/crypto/authencesn.c +++ b/crypto/authencesn.c @@ -279,7 +279,7 @@ static void authenc_esn_verify_ahash_don struct aead_request *req = areq->data; err = err ?: crypto_authenc_esn_decrypt_tail(req, 0); - aead_request_complete(req, err); + authenc_esn_request_complete(req, err); } static int crypto_authenc_esn_decrypt(struct aead_request *req)