Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6260644imu; Mon, 21 Jan 2019 06:02:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN4pED0oHLUf3cPzf+i9PRQTylZLFt/JyvRM+OpA2ZnES1EzF0GJwEz6RSMNHXboDRANsEP4 X-Received: by 2002:a62:9fd9:: with SMTP id v86mr29653750pfk.191.1548079322593; Mon, 21 Jan 2019 06:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079322; cv=none; d=google.com; s=arc-20160816; b=K0iuJ8usDbBh2y/PnY3yMqPITfCFnrAMv7TdHVF98jSurQYxvDYeA1c7SSHVk3pSUv IbLdIr0H5mqDRjIEwH6fIPoIjJq4ppXp7rlWUV+IoNbzvIGEwuo3Ff8cxPa8i26RIPVz v4/qaVld61+Dsbwop3B7av4XBOd4O0FZv5f/Mr0b67DLTYGhID/7B+Erk3OMVyubgW9Z Q1BuxYjnZzRoKtmbKLxFH39I3O5UvcLO8MzeC95gZsdCYENBmYUI2t6oXLm8C2sAFUUR TK4+JYxhw29QDIZjYND2m3tRLUNCUflwDPsUcZGrHtVUHW25ho4u2FIquj6MPofO2+gd Bghw== 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=1SNvLNZDIs/0OZfrEfZat5xGXzMPrwzAXU+QauuGrnU=; b=1GQ7a2G541yEJMkALdckSXOGD2MJ6eSIifuZ2RvN4aaYryx+84bUORFNOwHstrGafu e+2VS/p1gBFZVHZZOQ+69G1AP6hb2XexdPJilzmuUBjBoTszOLtMtS/ERiFjc4qmuqCq o5UY06QY8WgN0yO4jVPHam+IyXpmcU0VlYCX5gGqqKpgNHKwyprSBiCbUheZjWsdieXp yZek9rbk1HJPslI3YNuycACaGizklrFHneiP1VgqNyuzYLwbmr+QVG56aRa9rtEPH5Gj WgFgGN9WKFQKt02kXOyjYLockOneKSmRXOBW8L8sjQZWHalaR7KbWyGX58T6qE9W66N9 X/pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p54IVxfx; 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 x8si12725756plo.259.2019.01.21.06.01.38; Mon, 21 Jan 2019 06:02:02 -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=p54IVxfx; 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 S1731893AbfAUN7p (ORCPT + 99 others); Mon, 21 Jan 2019 08:59:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:45692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732214AbfAUN7g (ORCPT ); Mon, 21 Jan 2019 08:59:36 -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 52FBA2087F; Mon, 21 Jan 2019 13:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079175; bh=4y/ELLAHrrxDsXhegWJW6mpHDr5B6oQ1PRm/axThNc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p54IVxfx3YR7KZRf+Y96E5/bJpIMyFLTorb6eoJQgXPb/JJP8hVn76SJ18n94gBCr 57BJhkiX1TeZLhYQupbQwaZr+PZ7err+6adrlsBJrxm7bAACBgghUYgdRiwaqEvmnp +NTQZRd/mNm/BDoX07LXoA1rtH77sTjosu5aJZFw= 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.19 33/99] crypto: authencesn - Avoid twice completion call in decrypt path Date: Mon, 21 Jan 2019 14:48:25 +0100 Message-Id: <20190121134915.157123894@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-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)